Message1381

Author cgroves
Recipients
Date 2007-04-25.08:08:43
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The patch makes the hash value for all unhashable PyObjects 0.  Combined with the way GlobalRefs are used in a hashtable, this means that creating refs for two equal but distinct objects will only make a single ref.  This is undesirable as illustrated in the example I'm attaching: calling the second ref returns the first object.  

The only solution I can think of is to use System.identityHashCode(object) instead of object.hashCode().  As long as there isn't a case where Jython creates two separate Objects that refer to the same underlying Python object that should be fine.  I can't think of anything like that off the top of my head.
File Added: surprising_assignment.py
History
Date User Action Args
2008-02-20 17:17:39adminlinkissue1622207 messages
2008-02-20 17:17:39admincreate