projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2c25239
)
getset_descr_set(): guard against deletion (indicated by a set call
author
Guido van Rossum
<guido@python.org>
Fri, 24 Aug 2001 10:17:36 +0000
(10:17 +0000)
committer
Guido van Rossum
<guido@python.org>
Fri, 24 Aug 2001 10:17:36 +0000
(10:17 +0000)
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
patch
|
blob
|
history
diff --git
a/Objects/descrobject.c
b/Objects/descrobject.c
index a9ee2a4a1278d7b3f1775d8643824fd9b4936caf..c29dd833dfa757b4070e96b4fd7c5c735469ffcc 100644
(file)
--- 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);