mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
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?
This commit is contained in:
parent
2c25239215
commit
845fc48bf7
1 changed files with 4 additions and 1 deletions
|
|
@ -906,7 +906,10 @@ getset_descr_set(PyObject *self, PyObject *obj, PyObject *value)
|
||||||
PyErr_SetString(PyExc_AttributeError, "unsettable attribute");
|
PyErr_SetString(PyExc_AttributeError, "unsettable attribute");
|
||||||
return -1;
|
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)
|
if (res == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
Py_DECREF(res);
|
Py_DECREF(res);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue