commit | 0f56e90f0582a4171a9e3e1e2ffde2781be4bffd | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Sat Aug 14 23:52:08 2010 +0000 |
committer | Raymond Hettinger <python@rcn.com> | Sat Aug 14 23:52:08 2010 +0000 |
tree | 32bc9fd46a929f5ac2115b8591d54efad1ec9efa | |
parent | a893927491ef3bc7a4c3c9aa548be7d8ff677c38 [diff] [blame] |
Support cache sizes.
diff --git a/Lib/functools.py b/Lib/functools.py index f6ae4f4..9f28004 100644 --- a/Lib/functools.py +++ b/Lib/functools.py
@@ -144,7 +144,7 @@ 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]