#14159: Don't install callbacks on values of TripleDict, MonoDict
---------------------------------+------------------------------------------
Reporter: nbruin | Owner: tbd
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-5.8
Component: PLEASE CHANGE | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Comment (by SimonKing):
I thought that the following would expose the problem, but it doesn't:
{{{
sage: from sage.structure.coerce_dict import TripleDict
sage: import gc
sage: class Foo: pass
sage:
sage: a = 1
sage: b = 2
sage: c = 3
sage: v = Foo()
sage: w = Foo()
sage: T = TripleDict(13)
sage: T[a,b,c] = v
sage: T[a,b,c] = w
sage: del v
sage: _ = gc.collect()
sage: len([x for x in gc.get_objects() if isinstance(x,Foo)])
1
}}}
So, v got collected and thus the callback was executed. However:
{{{
sage: id(T[a,b,c])
85762632
sage: id(w)
85762632
}}}
The entry that was previously holding v did ''not'' get deleted when v's
callback was called.
So, are we really in trouble?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14159#comment:6>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.