Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful

This commit is contained in:
Nick Coghlan 2008-07-15 14:27:37 +00:00
parent 9ace15ca25
commit 53663a695e
14 changed files with 134 additions and 134 deletions

View file

@ -214,8 +214,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]))