]> granicus.if.org Git - python/commitdiff
clear the root with the cache
authorBenjamin Peterson <benjamin@python.org>
Fri, 16 Mar 2012 23:22:26 +0000 (18:22 -0500)
committerBenjamin Peterson <benjamin@python.org>
Fri, 16 Mar 2012 23:22:26 +0000 (18:22 -0500)
Lib/functools.py

index af24f423a20a9302f78be4c13a4b6972c39b6eac..3455d7c1909d8825b10c1997aee9fb50d6f62b40 100644 (file)
@@ -227,9 +227,11 @@ def lru_cache(maxsize=100, typed=False):
 
         def cache_clear():
             """Clear the cache and cache statistics"""
-            nonlocal hits, misses
+            nonlocal hits, misses, root
             with lock:
                 cache.clear()
+                root = []
+                root[:] = [root, root, None, None]
                 hits = misses = 0
 
         wrapper.cache_info = cache_info