mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Fix __hash__ in functools.cmp_to_key() to work with collections.Hashable.
This commit is contained in:
parent
5098d44354
commit
003be52932
3 changed files with 7 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
|
||||
|
||||
_CacheInfo = namedtuple("CacheInfo", "hits misses maxsize currsize")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue