#13394: Write a WeakValueDictionary with safer key removal
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner: rlm
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.13
Component: memleak | Resolution:
Keywords: | Merged in:
Authors: Simon King, Nils | Reviewers: Simon King
Bruin | Work issues:
Report Upstream: None of the above | Commit:
- read trac for reasoning. | 851cc9522dde332561101f1c84182a0a84b8eed4
Branch: | Stopgaps:
u/SimonKing/ticket/13394 |
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Replying to [comment:62 nbruin]:
> Aw, shoot. We do have a problem:
You mean: We ''would'' have a problem when the callback raised an error.
With the current commits (that silently return without error!) I get
{{{
sage: from sage.misc.weak_dict import WeakValueDictionary
sage: D=WeakValueDictionary()
sage: V=set([2])
sage: W=set([3])
sage: D[1]=V
sage: i=D.iteritems(); d=i.next(); del d #raise the guard
sage: del V #queue a callback
sage: D[1]=W #invalidate the callback (but it's queued!)
sage: len(D)
1
sage: del i
sage: len(D)
1
}}}
which I believe is correct.
> So: yes, we should remain silent on failure.
We already do...
--
Ticket URL: <http://trac.sagemath.org/ticket/13394#comment:63>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.