Message10106
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:20 | clevy | set | recipients:
+ clevy |
2015-06-10 19:33:20 | clevy | set | messageid: <1433964800.23.0.32050838658.issue2367@psf.upfronthosting.co.za> |
2015-06-10 19:33:20 | clevy | link | issue2367 messages |
2015-06-10 19:33:19 | clevy | create | |
|