From: Raymond Hettinger Date: Fri, 16 Mar 2012 18:21:39 +0000 (-0700) Subject: Eliminate duplicate link lookup. Minor cleanup. X-Git-Tag: v3.3.0a2~145 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57b2959d265426e40e08ff0a901855353b75d9fd;p=thirdparty%2FPython%2Fcpython.git Eliminate duplicate link lookup. Minor cleanup. --- diff --git a/Lib/functools.py b/Lib/functools.py index 66067428adc4..af24f423a20a 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