diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/weakrefobject.c | 6 |
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 */ |