Issue1839871

classification
Title: dict shouldn't call __setitem__ to initialise
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, tristanlk
Priority: normal Keywords:

Created on 2007-11-27.23:20:48 by tristanlk, last changed 2007-12-02.20:13:32 by cgroves.

Files
File name Uploaded Description Edit Remove
dict_inheritance_bug.py tristanlk, 2007-11-27.23:20:48
Messages
msg2020 (view) Author: tristan (tristanlk) Date: 2007-11-27.23:20:48
when a non-dict is passed as input to a dict __setitem__ is called to set the values. this is fine for dict objects, but can break things inheriting from dict (i.e. see attachment). __setitem__ shouldn't be called until __init__ is complete.

i'm working out of the trunk.

here's the outputs i get from the attached test case:

$ python dict_inheritance_bug.py 
{'a': 1}

$ jython dict_inheritance_bug.py
Traceback (innermost last):
  File "dict_inheritance_bug.py", line 9, in ?
  File "dict_inheritance_bug.py", line 3, in __init__
  File "dict_inheritance_bug.py", line 7, in __setitem__
AttributeError: '__main__.Test' object has no attribute 'doStuff'
msg2021 (view) Author: Charlie Groves (cgroves) Date: 2007-12-02.20:13:32
Fixed in r3754.  Thanks!
History
Date User Action Args
2007-11-27 23:20:48tristanlkcreate