mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
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:
parent
9ace15ca25
commit
53663a695e
14 changed files with 134 additions and 134 deletions
|
@ -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]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue