New submission from Dan Snider <mr.assume.a...@gmail.com>:
Isn't the point of setting typed=True to make it so that e.g. True doesn't register as a hit when there is already a cache entry for 1.0? Assuming that is the case, although this report specifically targets 3.8 I found no indication that what I believe is the cause of this has been fixed in the interim. def test(): from functools import lru_cache class No1: __eq__ = 0 .__eq__ __hash__ = 0 .__hash__ class No2: __eq__ = (0,).__contains__ def __hash__(self, /): return hash(0) @lru_cache(256, typed=False) def test(v): return [v] test(No1()), test(No1()), test(0.0), test(0) print(test.cache_info()) @lru_cache(256, typed=False) def test(v): return [v] test(No2()), test(No2()), test(0.0), test(0) print(test.cache_info()) CacheInfo(hits=0, misses=4, maxsize=256, currsize=4) CacheInfo(hits=2, misses=2, maxsize=256, currsize=2) ---------- messages: 388271 nosy: bup priority: normal severity: normal status: open title: bounded _lru_cache_wrapprer behaves as if typed=True when it wasn't versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43436> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com