summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2012-03-16 18:21:39 (GMT)
committerRaymond Hettinger <python@rcn.com>2012-03-16 18:21:39 (GMT)
commit57b2959d265426e40e08ff0a901855353b75d9fd (patch)
treea24c44f61b70a14e2653dd9ffd9605c1027df6ee
parenteb7491868556277836c7ec2ac04950c1f63f9f5f (diff)
downloadcpython-57b2959d265426e40e08ff0a901855353b75d9fd.zip
cpython-57b2959d265426e40e08ff0a901855353b75d9fd.tar.gz
cpython-57b2959d265426e40e08ff0a901855353b75d9fd.tar.bz2
Eliminate duplicate link lookup. Minor cleanup.
-rw-r--r--Lib/functools.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index 6606742..af24f42 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -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