summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-06-30 04:18:48 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-06-30 04:18:48 (GMT)
commitd693a81595ae3c617f5dd20f9a8bf8b7f130683b (patch)
tree9b967125a07413622eac5ed8b65933c378b9cdf5 /Objects/weakrefobject.c
parent562a855da062202e0af39cb290c3baf7228dc350 (diff)
downloadcpython-d693a81595ae3c617f5dd20f9a8bf8b7f130683b.zip
cpython-d693a81595ae3c617f5dd20f9a8bf8b7f130683b.tar.gz
cpython-d693a81595ae3c617f5dd20f9a8bf8b7f130683b.tar.bz2
Fix SF 762891: "del p[key]" on proxy object raises SystemError()
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index e26cb65..f5afb53 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -389,7 +389,11 @@ proxy_setitem(PyWeakReference *proxy, PyObject *key, PyObject *value)
{
if (!proxy_checkref(proxy))
return -1;
- return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value);
+
+ if (value == NULL)
+ return PyObject_DelItem(PyWeakref_GET_OBJECT(proxy), key);
+ else
+ return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value);
}
/* iterator slots */