summaryrefslogtreecommitdiff
path: root/Lib/functools.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/functools.py')
-rw-r--r--Lib/functools.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index f6ae4f4a64..9f28004b52 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -144,7 +144,7 @@ def lfu_cache(maxsize=100):
wrapper.misses += 1
if len(cache) > maxsize:
# purge the 10% least frequently used entries
- for key, _ in nsmallest(maxsize // 10,
+ for key, _ in nsmallest(maxsize // 10 or 1,
use_count.items(),
key=itemgetter(1)):
del cache[key], use_count[key]