Skip to content
Snippets Groups Projects
Unverified Commit 7ff22d6d authored by Sean Quah's avatar Sean Quah Committed by GitHub
Browse files

Fix `LruCache` corruption bug with a `size_callback` that can return 0 (#11454)

When all entries in an `LruCache` have a size of 0 according to the
provided `size_callback`, and `drop_from_cache` is called on a cache
node, the node would be unlinked from the LRU linked list but remain in
the cache dictionary. An assertion would be later be tripped due to the
inconsistency.

Avoid unintentionally calling `__len__` and use a strict `is None`
check instead when unwrapping the weak reference.
parent 5a0b652d
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment