[issue35780] Recheck logic in the C version of the lru_cache()

Serhiy Storchaka report at bugs.python.org
Sat Jan 19 06:28:16 EST 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

> If so, then why is the link being moved to the front of the lru_cache -- it should have remained at the oldest position.

It may be unintentionally. In any case, this is a case that should be very rare.

> The solution to this is only extract the link after a successful pop rather than before.

Then there is a possibility to pop the same key (from the last link) twice. The GIL can be released in _PyDict_Pop_KnownHash() and other thread can went the same way.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35780>
_______________________________________


More information about the Python-bugs-list mailing list