File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,8 +111,7 @@ def __ge__(self, other):
111111 return mycmp (self .obj , other .obj ) >= 0
112112 def __ne__ (self , other ):
113113 return mycmp (self .obj , other .obj ) != 0
114- def __hash__ (self ):
115- raise TypeError ('hash not implemented' )
114+ __hash__ = None
116115 return K
117116
118117try :
Original file line number Diff line number Diff line change 11import functools
2+ import collections
23import sys
34import unittest
45from test import support
@@ -510,6 +511,7 @@ def mycmp(x, y):
510511 key = functools .cmp_to_key (mycmp )
511512 k = key (10 )
512513 self .assertRaises (TypeError , hash , k )
514+ self .assertNotIsInstance (k , collections .Hashable )
513515
514516class TestTotalOrdering (unittest .TestCase ):
515517
@@ -718,12 +720,12 @@ def fib(n):
718720
719721def test_main (verbose = None ):
720722 test_classes = (
721- TestCmpToKey ,
722723 TestPartial ,
723724 TestPartialSubclass ,
724725 TestPythonPartial ,
725726 TestUpdateWrapper ,
726727 TestTotalOrdering ,
728+ TestCmpToKey ,
727729 TestWraps ,
728730 TestReduce ,
729731 TestLRU ,
Original file line number Diff line number Diff line change @@ -141,6 +141,8 @@ Library
141141
142142- logging: don't define QueueListener if Python has no thread support.
143143
144+ - functools.cmp_to_key() now works with collections.Hashable().
145+
144146- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get
145147 around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
146148
You can’t perform that action at this time.
0 commit comments