mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
Fix __hash__ in functools.cmp_to_key() to work with collections.Hashable.
This commit is contained in:
commit
e7a2430dde
3 changed files with 6 additions and 3 deletions
|
@ -111,8 +111,7 @@ def cmp_to_key(mycmp):
|
|||
return mycmp(self.obj, other.obj) >= 0
|
||||
def __ne__(self, other):
|
||||
return mycmp(self.obj, other.obj) != 0
|
||||
def __hash__(self):
|
||||
raise TypeError('hash not implemented')
|
||||
__hash__ = None
|
||||
return K
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue