Mercurial > cpython-lru_cache-weakref
diff Modules/cStringIO.c @ 8677:6170683e98e3 legacy-trunk
I_getattr(),
O_getattr(): Added read-only access to the closed attribute, based on comment
from Michael Scharf <Michael.Scharf@Rhein-Neckar.de>.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Fri, 17 Jul 1998 14:30:58 +0000 |
| parents | bbbd0b105e27 |
| children | 43464b1c880e |
line wrap: on
line diff
--- a/Modules/cStringIO.c Thu Jul 16 15:31:43 1998 +0000 +++ b/Modules/cStringIO.c Fri Jul 17 14:30:58 1998 +0000 @@ -389,9 +389,12 @@ static PyObject * O_getattr(Oobject *self, char *name) { - if (strcmp(name, "softspace") == 0) { + if (name[0] == 's' && strcmp(name, "softspace") == 0) { return PyInt_FromLong(self->softspace); } + else if (name[0] == 'c' && strcmp(name, "closed") == 0) { + return PyInt_FromLong(self->closed); + } return Py_FindMethod(O_methods, (PyObject *)self, name); } @@ -496,6 +499,9 @@ static PyObject * I_getattr(Iobject *self, char *name) { + if (name[0] == 'c' && strcmp(name,"closed") == 0) { + return PyInt_FromLong(self->closed); + } return Py_FindMethod(I_methods, (PyObject *)self, name); }
