Skip to content

Commit 26f9f90

Browse files
committed
Revert "Maintain invariant of maxsize items in cache attribute in MultiHitLRUCache"
This reverts commit ff22bac. See the explanation at https://github.com/python/cpython/pull/107613/files#r1284124385 for more information.
1 parent a03483d commit 26f9f90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,9 +1265,9 @@ variants of :func:`functools.lru_cache`:
12651265
# complications in a multi-threaded environment where
12661266
# a race condition may cause an exception
12671267
self.requests.pop(args, None)
1268-
if len(self.cache) == self.maxsize:
1269-
self.cache.popitem(last=False)
12701268
self.cache[args] = result
1269+
if len(self.cache) > self.maxsize:
1270+
self.cache.popitem(last=False)
12711271
return result
12721272
12731273
.. doctest::

0 commit comments

Comments
 (0)