Author clevy
Recipients clevy
Date 2015-06-10.19:33:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Take two subclasses of dict which define __hash__ and __eq__ (for example, we want to create an ImmutableMap) so that their hashes are equal, and dict.__eq__(dict1, dict2) returns True, but the objects are NOT equal due to their custom __eq__.

When using them BOTH as dictionary keys, Jython ignores the custom __eq__ upon hash collision and simply overwrites one key with the other. Note from the included tests that a hash collision is NOT the cause; if dict.__eq__(d1, d2) is False, both will still be used as keys.

This problem does not show up when inserting from list, tuple, object or any other classes I have tried.

Of the included unit tests, "test_distinct_in_set" and "test_distinct_as_keys" fail in Jython alone; the rest pass in Jython, CPython 2 and 3, and PyPy 2 and 3.
Date User Action Args
2015-06-10 19:33:20clevysetrecipients: + clevy
2015-06-10 19:33:20clevysetmessageid: <>
2015-06-10 19:33:20clevylinkissue2367 messages
2015-06-10 19:33:19clevycreate