]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Eliminate duplicate link lookup. Minor cleanup.
authorRaymond Hettinger <python@rcn.com>
Fri, 16 Mar 2012 18:21:39 +0000 (11:21 -0700)
committerRaymond Hettinger <python@rcn.com>
Fri, 16 Mar 2012 18:21:39 +0000 (11:21 -0700)
Lib/functools.py

index 66067428adc4e6d3fd96025794bf47e64c5a6059..af24f423a20a9302f78be4c13a4b6972c39b6eac 100644 (file)
@@ -191,11 +191,11 @@ def lru_cache(maxsize=100, typed=False):
                     key += tuple(map(type, args))
                     if kwds:
                         key += tuple(type(v) for k, v in sorted_items)
-                PREV, NEXT = 0, 1               # names of link fields
+                PREV = 0                        # names of link fields
+                NEXT = 1
                 with lock:
                     link = cache_get(key)
                     if link is not None:
-                        link = cache[key]
                         # record recent use of the key by moving it to the front of the list
                         link_prev, link_next, key, result = link
                         link_prev[NEXT] = link_next