From: Guido van Rossum Date: Fri, 24 Aug 2001 10:17:36 +0000 (+0000) Subject: getset_descr_set(): guard against deletion (indicated by a set call X-Git-Tag: v2.2a3~347 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=845fc48bf739fc04ed3e082aec772c2dc72bf1b6;p=thirdparty%2FPython%2Fcpython.git 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? --- diff --git a/Objects/descrobject.c b/Objects/descrobject.c index a9ee2a4a1278..c29dd833dfa7 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);