Change the way __hash__ is inherited; when __eq__ or __cmp__ is overridden
but __hash__ is not, set __hash__ explicitly to None (and tp_hash to NULL).
All unit tests pass now!
diff --git a/Lib/test/mapping_tests.py b/Lib/test/mapping_tests.py
index 1c570b6..b917540 100644
--- a/Lib/test/mapping_tests.py
+++ b/Lib/test/mapping_tests.py
@@ -545,6 +545,8 @@
class BadEq(object):
def __eq__(self, other):
raise Exc()
+ def __hash__(self):
+ return 24
d = self._empty_mapping()
d[BadEq()] = 42
@@ -630,6 +632,8 @@
class BadCmp(object):
def __eq__(self, other):
raise Exc()
+ def __hash__(self):
+ return 42
d1 = self._full_mapping({BadCmp(): 1})
d2 = self._full_mapping({1: 1})