One function
cachedmethod in tkem/cachetools
The author described this change as “Fix #107: Remove 'self' from @cachedmethod key arguments.”. It counts as a record because the check below fails on the code as it stood at fb0e9cdb3 and passes on 4dbbef9b0, with nothing else changed between the two runs.
Projecttkem/cachetools
Fix saved2018-10-27
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a docstring
Decorator to wrap a class or instance method with a memoizing callable that saves results in a cache.
The change
| 9 | 9 | c = cache(self) | |
| 10 | 10 | if c is None: | |
| 11 | 11 | return method(self, *args, **kwargs) | |
| 12 | - | k = key(self, *args, **kwargs) | |
| 12 | + | k = key(*args, **kwargs) | |
| 13 | 13 | try: | |
| 14 | 14 | return c[k] | |
| 15 | 15 | except KeyError: | |
| ⋯ | |||
| 25 | 25 | c = cache(self) | |
| 26 | 26 | if c is None: | |
| 27 | 27 | return method(self, *args, **kwargs) | |
| 28 | - | k = key(self, *args, **kwargs) | |
| 28 | + | k = key(*args, **kwargs) | |
| 29 | 29 | try: | |
| 30 | 30 | with lock(self): | |
| 31 | 31 | return c[k] | |
The check that tells the two apart
fail→pass·tests/test_method.py::CachedMethodTest::test_dict
Check file tests/test_method.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 itfb0e9cdb3ee219ffda7b979961bc1cf67d7bb1df
Broken version dated2018-10-27
Modulecachetools.__init__
Units changedcachedmethod
Fingerprint37daffb8a14fa689
Checked2026-08-18 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
- 2026-07-22TLRUCache
- 2026-03-08Fix #218: Fix and properly document @cachedmethod.cache_key handling.
- 2026-03-05_DescriptorBase
- 2024-08-18Fix #292, fix #205, fix #103: TTLCache.expire() returns iterable of expired (key, value) pairs.
- 2024-07-15mru_cache
- 2021-12-21Fix #159: Pass self to @cachedmethod key function.