From: Benjamin Peterson Date: Fri, 16 Mar 2012 23:22:26 +0000 (-0500) Subject: clear the root with the cache X-Git-Tag: v3.3.0a2~141^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=954cf578c760e2b9e0fe9b3eedcfd3d1bfc7f7ec;p=python clear the root with the cache --- diff --git a/Lib/functools.py b/Lib/functools.py index af24f423a2..3455d7c190 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -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