[ python-Bugs-1012315 ] weakref.WeakValueDictionary should override .has_key()

SourceForge.net noreply at sourceforge.net
Thu Aug 19 23:49:24 CEST 2004


Bugs item #1012315, was opened at 2004-08-19 11:39
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1012315&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Myers Carpenter (myers_carpenter)
Assigned to: Raymond Hettinger (rhettinger)
Summary: weakref.WeakValueDictionary should override .has_key()

Initial Comment:
.has_key() currently does not return the correct info
for a weakref.WeakValueDictionary.  When you call it
some times tells you that a key exists even tho the
value is no longer in RAM.

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-08-19 16:49

Message:
Logged In: YES 
user_id=80475

I loaded a fix into Py2.4.  See Lib/weakref.py 1.25

What was there before should have worked fine but it is
possible that values were being deleted by GC or threads
after the internal has_key check and the return.  The patch
goes a step further and checks a lookedup object for a None
value.

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

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


More information about the Python-bugs-list mailing list