mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
Flatten the lru cache keyword args tuple for better memory utilization.
This commit is contained in:
parent
1182351e69
commit
678e7f3be6
1 changed files with 3 additions and 1 deletions
|
@ -185,7 +185,9 @@ def lru_cache(maxsize=100, typed=False):
|
|||
key = args
|
||||
if kwds:
|
||||
sorted_items = tuple(sorted(kwds.items()))
|
||||
key += kwd_mark + sorted_items
|
||||
key += kwd_mark
|
||||
key += tuple(k for k, v in sorted_items)
|
||||
key += tuple(v for k, v in sorted_items)
|
||||
if typed:
|
||||
key += tuple(type(v) for v in args)
|
||||
if kwds:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue