]> granicus.if.org Git - python/commitdiff
merge
authorRaymond Hettinger <python@rcn.com>
Mon, 4 Mar 2013 08:54:45 +0000 (03:54 -0500)
committerRaymond Hettinger <python@rcn.com>
Mon, 4 Mar 2013 08:54:45 +0000 (03:54 -0500)
1  2 
Lib/functools.py

index a019268d4f63842f6d691ce612cd0e9cbfd8b201,87c1b6992e2ffc363f9d1eed304ce63562f87eea..02bff42bd3f347abf0bec359a2ede5730b3d5918
@@@ -303,8 -283,9 +307,8 @@@ def lru_cache(maxsize=128, typed=False)
                          # put result in a new link at the front of the queue
                          last = root[PREV]
                          link = [last, root, key, result]
-                         cache[key] = last[NEXT] = root[PREV] = link
+                         last[NEXT] = root[PREV] = cache[key] = link
 -                        currsize += 1
 -                        full = (currsize == maxsize)
 +                        full = (len(cache) == maxsize)
                      misses += 1
                  return result