[ python-Bugs-1196315 ] WeakValueDictionary.__init__ is backwards

SourceForge.net noreply at sourceforge.net
Sat Jun 4 09:19:17 CEST 2005


Bugs item #1196315, was opened at 2005-05-06 03:59
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1196315&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Pavel Pergamenshchik (ppergame)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: WeakValueDictionary.__init__ is backwards

Initial Comment:
>>> from weakref import WeakValueDictionary as wvd
>>> class A:
...     pass
... 
>>> wvd({1:A()})
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/weakref.py", line 46, in
__init__
    UserDict.UserDict.__init__(self, *args, **kw)
  File "/usr/lib/python2.4/UserDict.py", line 7, in
__init__
    self.update(dict)
  File "/usr/lib/python2.4/weakref.py", line 161, in update
    d[key] = KeyedRef(o, self._remove, key)
AttributeError: WeakValueDictionary instance has no
attribute '_remove'


WeakValueDictionary.__init__ calls UserDict.__init__
first and sets self._remove second. It should do it the
other way around. This is a regression from 2.3.


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

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-04 09:19

Message:
Logged In: YES 
user_id=1188172

Okay to checkin?

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

Comment By: Mike C. Fletcher (mcfletch)
Date: 2005-05-11 21:23

Message:
Logged In: YES 
user_id=34901

I would agree that the order is definitely broken.

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

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-05-10 05:36

Message:
Logged In: YES 
user_id=80475

Fred, I believe this was your change (1.23).
The OP's request apprears correct to me.

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

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


More information about the Python-bugs-list mailing list