diff options
author | Raymond Hettinger <python@rcn.com> | 2017-01-09 01:29:21 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2017-01-09 01:29:21 (GMT) |
commit | ac7c5acf9b1e474adfae5da6841e0d4cb343d7e8 (patch) | |
tree | abebf8a6965be6ad10beda6b0076f5a4d4c62b93 /Lib/functools.py | |
parent | ce16c6827c3ce1253cf63518ef1da30a88f50623 (diff) | |
parent | 4ee39141e84c511e389080fa3163be043718ea14 (diff) | |
download | cpython-ac7c5acf9b1e474adfae5da6841e0d4cb343d7e8.zip cpython-ac7c5acf9b1e474adfae5da6841e0d4cb343d7e8.tar.gz cpython-ac7c5acf9b1e474adfae5da6841e0d4cb343d7e8.tar.bz2 |
merge
Diffstat (limited to 'Lib/functools.py')
-rw-r--r-- | Lib/functools.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index b278bc2..89f2cf4 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -421,7 +421,7 @@ class _HashedSeq(list): def _make_key(args, kwds, typed, kwd_mark = (object(),), fasttypes = {int, str, frozenset, type(None)}, - sorted=sorted, tuple=tuple, type=type, len=len): + tuple=tuple, type=type, len=len): """Make a cache key from optionally typed positional and keyword arguments The key is constructed in a way that is flat as possible rather than @@ -434,14 +434,13 @@ def _make_key(args, kwds, typed, """ key = args if kwds: - sorted_items = sorted(kwds.items()) key += kwd_mark - for item in sorted_items: + for item in kwds.items(): key += item if typed: key += tuple(type(v) for v in args) if kwds: - key += tuple(type(v) for k, v in sorted_items) + key += tuple(type(v) for v in kwds.values()) elif len(key) == 1 and type(key[0]) in fasttypes: return key[0] return _HashedSeq(key) |