Issue947306

classification
Title: 2.3a0 bug in weakref.WeakValueDictionary
Type: Severity: normal
Components: Library Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey, rabidechidna
Priority: low Keywords:

Created on 2004-05-03.22:02:24 by rabidechidna, last changed 2008-06-03.03:47:52 by pjenvey.

Messages
msg903 (view) Author: D Morley (rabidechidna) Date: 2004-05-03.22:02:24
In Jython 2.3a0, (as in Python 2.3) the 
WeakValueDictionary.__makeremove method in Lib/weakref.py 
relies on being able to make a weakref of self. In Jython, this 
raises an exception, because _weakref.ref(x) requires x to be 
hashable (which WeakValueDictionary is not). In Python, 
_weakref.ref(x) works on unhashable objects.

The problem did not arise in Jython 2.1, as the code in Lib/weakref  
did not try to create a weakref to itself (and so resulted in hash 
tables containing circular references).

Possible fixes off the top of my head:

(better) Fix _weakref.java so it doesn't require a hashable object.

(easier) Don't bother creating a weakref to self in 
WeakValueDictionary.__makeremove since Jython can GC circular 
references.

There are probably similar problems in other parts of weakref.py
msg3216 (view) Author: Philip Jenvey (pjenvey) Date: 2008-06-03.03:47:39
_weakref.ref was fixed to handle non hashable objects (see bug #1622207), 
which fixes this issue.
History
Date User Action Args
2008-06-03 03:47:52pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3216
nosy: + pjenvey
2004-05-03 22:02:24rabidechidnacreate