summaryrefslogtreecommitdiffstats
path: root/Objects/descrobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-08-24 10:17:36 (GMT)
committerGuido van Rossum <guido@python.org>2001-08-24 10:17:36 (GMT)
commit845fc48bf739fc04ed3e082aec772c2dc72bf1b6 (patch)
tree47ddf8f1d4961dd495ee9cd8630f0113c67b3bf9 /Objects/descrobject.c
parent2c25239215964746e030d9f7e47232d4dca5746d (diff)
downloadcpython-845fc48bf739fc04ed3e082aec772c2dc72bf1b6.zip
cpython-845fc48bf739fc04ed3e082aec772c2dc72bf1b6.tar.gz
cpython-845fc48bf739fc04ed3e082aec772c2dc72bf1b6.tar.bz2
getset_descr_set(): guard against deletion (indicated by a set call
with a NULL value), in a somewhat lame way: call the set() function with one argument. Should I add a 3rd function, 'del', instead?
Diffstat (limited to 'Objects/descrobject.c')
-rw-r--r--Objects/descrobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index a9ee2a4..c29dd83 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -906,7 +906,10 @@ getset_descr_set(PyObject *self, PyObject *obj, PyObject *value)
PyErr_SetString(PyExc_AttributeError, "unsettable attribute");
return -1;
}
- res = PyObject_CallFunction(gs->set, "(OO)", obj, value);
+ if (value == NULL)
+ res = PyObject_CallFunction(gs->set, "(O)", obj);
+ else
+ res = PyObject_CallFunction(gs->set, "(OO)", obj, value);
if (res == NULL)
return -1;
Py_DECREF(res);