From 954cf578c760e2b9e0fe9b3eedcfd3d1bfc7f7ec Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 16 Mar 2012 18:22:26 -0500 Subject: [PATCH] clear the root with the cache --- Lib/functools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.50.1