Skip to content

Write a WeakValueDictionary with safer key removal #13394

@nbruin

Description

@nbruin

On ticket #12313 we found that the use of WeakValueDictionaries as caches can cause removal callbacks in rather harsh environments. Normal WeakValueDictionaries remove keys with dead values by looking up the key. This involves Python equality testing on the key, which can cause any kind of operation in Sage. We need a dictionary where we can delete entries without key comparisons. See below for possible strategies.

To the release manager:

Apply attachment: trac13394-weak_value_dictionary.patch

Upstream: None of the above - read trac for reasoning.

CC: @simon-king-jena

Component: memleak

Author: Simon King, Nils Bruin

Reviewer: Nils Bruin, Simon King

Merged: sage-5.13.beta3

Issue created by migration from https://trac.sagemath.org/ticket/13394

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions