diff --git a/Lib/functools.py b/Lib/functools.py index 4dd5913e0df..7fc42af3869 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -226,9 +226,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