mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
I_getattr(),
O_getattr(): Added read-only access to the closed attribute, based on comment from Michael Scharf <Michael.Scharf@Rhein-Neckar.de>.
This commit is contained in:
parent
7f1d3aa3d9
commit
7589b71c4a
1 changed files with 7 additions and 1 deletions
|
|
@ -389,9 +389,12 @@ O_dealloc(Oobject *self) {
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
O_getattr(Oobject *self, char *name) {
|
O_getattr(Oobject *self, char *name) {
|
||||||
if (strcmp(name, "softspace") == 0) {
|
if (name[0] == 's' && strcmp(name, "softspace") == 0) {
|
||||||
return PyInt_FromLong(self->softspace);
|
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);
|
return Py_FindMethod(O_methods, (PyObject *)self, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -496,6 +499,9 @@ I_dealloc(Iobject *self) {
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
I_getattr(Iobject *self, char *name) {
|
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);
|
return Py_FindMethod(I_methods, (PyObject *)self, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue