Issue 1012315: weakref.WeakValueDictionary should override .has_key() (original) (raw)

Issue1012315

Created on 2004-08-19 16:39 by myers_carpenter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg22141 - (view) Author: Myers Carpenter (myers_carpenter) Date: 2004-08-19 16:39
.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.
msg22142 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-08-19 21:49
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.
History
Date User Action Args
2022-04-11 14:56:06 admin set github: 40789
2004-08-19 16:39:04 myers_carpenter create