[Python-bugs-list] [ python-Bugs-447152 ] WeakValueDictionary wrong except. rised

noreply@sourceforge.net noreply@sourceforge.net
Thu, 02 Aug 2001 05:11:53 -0700


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

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Niki Spahiev (nikis)
Assigned to: Nobody/Anonymous (nobody)
Summary: WeakValueDictionary wrong except. rised

Initial Comment:
PythonWin 2.1 (#15, Jun 18 2001, 21:42:28) [MSC 32 bit
(Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond
(MarkH@ActiveState.com) - see 'Help/About PythonWin'
for further copyright information.
>>> import weakref
>>> wd = weakref.WeakValueDictionary()
>>> class test: pass
...
>>> t = test()
>>> wd[1] = t
>>> del t
>>> wd[1]
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "c:\python21\lib\weakref.py", line 35, in __getitem__
o = self.data.get(key)()
TypeError: object is not callable: None
>>> 


FIX:
change
o = self.data.get(key)()
to
o = self.data[key]()


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

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