File tree 3 files changed +7
-3
lines changed 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,7 @@ def __ge__(self, other):
111
111
return mycmp (self .obj , other .obj ) >= 0
112
112
def __ne__ (self , other ):
113
113
return mycmp (self .obj , other .obj ) != 0
114
- def __hash__ (self ):
115
- raise TypeError ('hash not implemented' )
114
+ __hash__ = None
116
115
return K
117
116
118
117
_CacheInfo = namedtuple ("CacheInfo" , "hits misses maxsize currsize" )
Original file line number Diff line number Diff line change 1
1
import functools
2
+ import collections
2
3
import sys
3
4
import unittest
4
5
from test import support
@@ -446,7 +447,8 @@ def mycmp(x, y):
446
447
return y - x
447
448
key = functools .cmp_to_key (mycmp )
448
449
k = key (10 )
449
- self .assertRaises (TypeError , hash (k ))
450
+ self .assertRaises (TypeError , hash , k )
451
+ self .assertFalse (isinstance (k , collections .Hashable ))
450
452
451
453
class TestTotalOrdering (unittest .TestCase ):
452
454
@@ -660,6 +662,7 @@ def test_main(verbose=None):
660
662
TestPythonPartial ,
661
663
TestUpdateWrapper ,
662
664
TestTotalOrdering ,
665
+ TestCmpToKey ,
663
666
TestWraps ,
664
667
TestReduce ,
665
668
TestLRU ,
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ Library
81
81
82
82
- logging: don't define QueueListener if Python has no thread support.
83
83
84
+ - functools.cmp_to_key() now works with collections.Hashable().
85
+
84
86
- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get
85
87
around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
86
88
You can’t perform that action at this time.
0 commit comments