[Python-bugs-list] [ python-Bugs-762891 ] "del p[key]" on proxy object raises SystemError()
SourceForge.net
noreply@sourceforge.net
Sun, 29 Jun 2003 17:14:00 -0700
Bugs item #762891, was opened at 2003-06-29 17:17
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=762891&group_id=5470
Category: Python Interpreter Core
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Muller (mikemuller)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: "del p[key]" on proxy object raises SystemError()
Initial Comment:
Attempting to perform a __delitem__ on a proxy object
raises the SystemError "null argument to internal
routine". Example code:
-------------------------------------------------------
import weakref
class Foo:
def __delitem__(self, accessor):
print 'deleting %s' % accessor
g = Foo()
f = weakref.proxy(g)
del f[0]
-------------------------------------------------------
The problem appears to be that proxy_setitem() in
weakrefobject.c indiscriminately calls
PyObject_SetItem() on the proxied object without
checking to see if the "value" parameter is NULL, as it
is when it is called from a __delitem__ on the proxy.
I have uploaded a patch that fixes the problem.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=762891&group_id=5470