#13378: Do not cache the non-existence of coerce/convert map too often, and do
not
pretend that there is a conversion where it doesn't make sense at all
----------------------------------------------------+-----------------------
Reporter: SimonKing | Owner: robertwb
Type: defect | Status:
needs_review
Priority: major | Milestone: sage-5.6
Component: coercion | Resolution:
Keywords: coercion conversion object cache | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
----------------------------------------------------+-----------------------
Comment (by SimonKing):
Replying to [comment:8 robertwb]:
> Could you clarify under what circumstances not having this code pollutes
the cache?
Unfortunately, I did not write in the ticket description what use case
made me create this ticket. But probably it was some experimental code on
the computation of Ext algebras of basic algebras (i.e., finite-
dimensional path algebra quotients).
Anyway. The problem is that in the coercion code one quite typically has
{{{
if self.has_coerce_map_from(P):
...
}}}
without checking whether P really is a parent or type. And that means
trouble, if P happens to be, say, an element (Yes, that did occur! But I
don't know where I had originally found it). See the ticket description
for an example.
Of course, if P is neither a parent nor a type, then there is no coercion
map from P to self. And as you know, the coercion framework would not only
cache a coercion map from P to self, but it would also cache the non-
existence of a coercion map from P to self.
So, the trouble starts if P runs over many elements that are not
weakreffable. For each element P, the coercion framework would store the
value ``None`` in self's coercion dictionary. And since the element is not
weakreffable, the entry will stay in cache forever, and I think this may
even prevent self from being garbage collected.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13378#comment:9>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.