diff options
author | Fred Drake <fdrake@acm.org> | 1998-07-17 14:30:58 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1998-07-17 14:30:58 (GMT) |
commit | 7589b71c4afbbb098b47eb7f827f8648cf214a21 (patch) | |
tree | 6944ae9f4aad4ae1935673822f1b584567d440f6 /Modules/cStringIO.c | |
parent | 7f1d3aa3d957aaa358bb41086980cac3d17614f7 (diff) | |
download | cpython-7589b71c4afbbb098b47eb7f827f8648cf214a21.zip cpython-7589b71c4afbbb098b47eb7f827f8648cf214a21.tar.gz cpython-7589b71c4afbbb098b47eb7f827f8648cf214a21.tar.bz2 |
I_getattr(),
O_getattr(): Added read-only access to the closed attribute, based on comment
from Michael Scharf <Michael.Scharf@Rhein-Neckar.de>.
Diffstat (limited to 'Modules/cStringIO.c')
-rw-r--r-- | Modules/cStringIO.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index 09713e3..2d7c940 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -389,9 +389,12 @@ O_dealloc(Oobject *self) { 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 @@ I_dealloc(Iobject *self) { 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); } |