diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-09-03 13:32:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-09-03 13:32:24 (GMT) |
commit | 9fd5374d4e7d75bfdaa862df15d0f3fbee5b18ca (patch) | |
tree | 54ef5a44a19832e93163e47396e9e352ff4ede91 /Modules/_io | |
parent | 35c912f3a2910c744b569eac88c2c404c625368e (diff) | |
parent | f6f3a3544783496301537bc5c946b58b0e5cbac8 (diff) | |
download | cpython-9fd5374d4e7d75bfdaa862df15d0f3fbee5b18ca.zip cpython-9fd5374d4e7d75bfdaa862df15d0f3fbee5b18ca.tar.gz cpython-9fd5374d4e7d75bfdaa862df15d0f3fbee5b18ca.tar.bz2 |
merge 3.2 (#12878)
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/iobase.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index f06f562..2c59d42 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -156,6 +156,19 @@ 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) { @@ -691,6 +704,7 @@ static PyMethodDef iobase_methods[] = { }; static PyGetSetDef iobase_getset[] = { + {"__dict__", iobase_get_dict, NULL, NULL}, {"closed", (getter)iobase_closed_get, NULL, NULL}, {NULL} }; |