Kaydet (Commit) 845fc48b authored tarafından Guido van Rossum's avatar Guido van Rossum

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?
üst 2c252392
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment