mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
use new generic __dict__ descriptor implementations
This commit is contained in:
parent
8eb1269c34
commit
23d7f12ffb
4 changed files with 6 additions and 141 deletions
|
@ -159,19 +159,6 @@ iobase_closed_get(PyObject *self, void *context)
|
|||
return PyBool_FromLong(IS_CLOSED(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
iobase_get_dict(PyObject *self)
|
||||
{
|
||||
PyObject **dictptr = _PyObject_GetDictPtr(self);
|
||||
PyObject *dict;
|
||||
assert(dictptr);
|
||||
dict = *dictptr;
|
||||
if (dict == NULL)
|
||||
dict = *dictptr = PyDict_New();
|
||||
Py_XINCREF(dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
_PyIOBase_check_closed(PyObject *self, PyObject *args)
|
||||
{
|
||||
|
@ -714,7 +701,7 @@ static PyMethodDef iobase_methods[] = {
|
|||
};
|
||||
|
||||
static PyGetSetDef iobase_getset[] = {
|
||||
{"__dict__", (getter)iobase_get_dict, NULL, NULL},
|
||||
{"__dict__", PyObject_GenericGetDict, NULL, NULL},
|
||||
{"closed", (getter)iobase_closed_get, NULL, NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue