[Python-bugs-list] [ python-Bugs-451638 ] [2.2a] delitem undefined for dictionary

noreply@sourceforge.net noreply@sourceforge.net
Thu, 16 Aug 2001 10:57:24 -0700


Bugs item #451638, was opened at 2001-08-16 10:48
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=451638&group_id=5470

Category: Type/class unification
Group: Python 2.2
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Allan Crooks (amc1)
Assigned to: Guido van Rossum (gvanrossum)
Summary: [2.2a] delitem undefined for dictionary

Initial Comment:
Hi,

Header pretty much says what the problem is.

It's also undefined for list. The following code 
should illustrate it clearly enough


>>> class d2(dictionary):
...     def __setitem__(self, key, value):
...         if value==0:
...             del self[key]
...         else:
...             dictionary.__setitem__(self, key, 
value)
...
>>> d = d2()
>>> d.update({'a': 5})
>>> d
{'a': 5}
>>> d['a'] = 10
>>> d
{'a': 10}
>>> d['a'] = 0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 4, in __setitem__
SystemError: NULL object passed to Py_BuildValue
>>>



----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-16 10:57

Message:
Logged In: YES 
user_id=6380

This is a duplicate of bug 442791. It's fixed in CVS.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=451638&group_id=5470