From 845fc48bf739fc04ed3e082aec772c2dc72bf1b6 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 24 Aug 2001 10:17:36 +0000 Subject: 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? --- Objects/descrobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v0.12