From: Raymond Hettinger Date: Sun, 29 Apr 2012 19:28:02 +0000 (-0700) Subject: Flatten the lru cache keyword args tuple for better memory utilization. X-Git-Tag: v3.3.0a3~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=678e7f3be658df7e1bd06bb0c37d820143f15eca;p=thirdparty%2FPython%2Fcpython.git Flatten the lru cache keyword args tuple for better memory utilization. --- diff --git a/Lib/functools.py b/Lib/functools.py index ae4175d6a082..1e7795f79203 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -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: