One function

mru_cache in tkem/cachetools

The author described this change as Fix #256: Deprecate @mru_cache decorator.. It counts as a record because the check below fails on the code as it stood at 8f0d74a14 and passes on d3598664c, with nothing else changed between the two runs.

Fix saved2024-07-15
Sharing licenceMIT · LICENSE
Change size+4 0

What the code was meant to do, written into the code itself as a docstring

Decorator to wrap a function with a memoizing callable that saves up to `maxsize` results based on a Most Recently Used (MRU) algorithm.

The change

33 up to `maxsize` results based on a Most Recently Used (MRU)
44 algorithm.
55 """
6+ from warnings import warn
7+
8+ warn("@mru_cache is deprecated", DeprecationWarning, stacklevel=2)
9+
610 if maxsize is None:
711 return _cache({}, None, typed)
812 elif callable(maxsize):

The check that tells the two apart

failpass·tests/test_func.py::MRUDecoratorTest::test_decorator

Check file tests/test_func.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it8f0d74a145f90e2672371b61aa8f82614adeefd7
Broken version dated2024-07-15
Modulecachetools.func
Units changedmru_cache
Fingerprint89441cdef5acb15b
Checked2026-08-17 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in tkem/cachetools