Manual forward port of 64962 - use PyObject_HashNotImplemented as a tp_hash level indicator that the default hash implementation has not been inherited

This commit is contained in:
Nick Coghlan 2008-07-15 15:46:38 +00:00
parent e65282114e
commit d1abd25ed8
12 changed files with 122 additions and 94 deletions

View file

@ -212,8 +212,7 @@ class CommonTest(unittest.TestCase):
# So instances of AllEq must be found in all non-empty sequences.
def __eq__(self, other):
return True
def __hash__(self):
raise NotImplemented
__hash__ = None # Can't meet hash invariant requirements
self.assert_(AllEq() not in self.type2test([]))
self.assert_(AllEq() in self.type2test([1]))