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.

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

99 c = cache(self)
1010 if c is None:
1111 return method(self, *args, **kwargs)
12- k = key(self, *args, **kwargs)
12+ k = key(*args, **kwargs)
1313 try:
1414 return c[k]
1515 except KeyError:
2525 c = cache(self)
2626 if c is None:
2727 return method(self, *args, **kwargs)
28- k = key(self, *args, **kwargs)
28+ k = key(*args, **kwargs)
2929 try:
3030 with lock(self):
3131 return c[k]

The check that tells the two apart

failpass·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