Issue #11707: Fast C version of functools.cmp_to_key()
diff --git a/Lib/functools.py b/Lib/functools.py
index 3bffbac..098f6b6 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -97,7 +97,7 @@
"""Convert a cmp= function into a key= function"""
class K(object):
__slots__ = ['obj']
- def __init__(self, obj, *args):
+ def __init__(self, obj):
self.obj = obj
def __lt__(self, other):
return mycmp(self.obj, other.obj) < 0
@@ -115,6 +115,11 @@
raise TypeError('hash not implemented')
return K
+try:
+ from _functools import cmp_to_key
+except ImportError:
+ pass
+
_CacheInfo = namedtuple("CacheInfo", "hits misses maxsize currsize")
def lru_cache(maxsize=100):