#14711: Weak references in the coercion graph
-------------------------------------+-------------------------------------
Reporter: jpflori | Owner: davidloeffler
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-6.1
Component: number fields | Resolution:
Keywords: memleak, number | Merged in:
field, QuadraticField | Reviewers: Jean-Pierre Flori
Authors: Simon King | Work issues:
Report Upstream: N/A | Commit:
Branch: | 0af59ea93689cb6abb9d3fae0f1cf11f2aee5cca
u/jpflori/ticket/14711 | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Replying to [comment:180 tscrim]:
> However I get the following doctest failing in `parent.pyx`:
> {{{
> The following was fixed in :trac:`4740`::
>
> sage: F = GF(13)
> sage: F.coerce_map_from(F) is F.coerce_map_from(F)
> True
> }}}
> It's returning `False` which I think is okay, but I'd need someone more
experienced in the finite fields code to verify that it's okay...
I suppose what we want to test here is in fact that ''internally'' coerce
maps are cached, and thus identical objects are used when one
''internally'' asks for the coerce maps.
Hence, I think one should test `F._internal_coerce_map_from(F) is
F._internal_coerce_map_from(F)`, adding a comment that this is just a test
and `_internal_coerce_map_from()` is, well, internal.
> I'm also getting a strange `<BLANKLINE>` in a doctest in `coerce.pyx`,
which is causing a doctest failure. My guess is it's somehow coming from
the warning message...
Hmmm. This needs to be fixed.
> I'd like to know if we're okay just swapping the old `coerce_map_from()`
to the
> `_internal_coerce_map_from()`? I think we'd want to do this anytime the
user will not have access
> to the maps, and I think they are safe to do so, but could someone else
double-check this for me?
I think it is almost exactly what we want.
Perhaps with a little refinement:
- In doctests, we should use `coerce_map_from()`, since we want to see
proper maps there, except for educational purposes such as the test
mentioned above.
- In code, we will mostly want `_internal_coerce_map_from()`.
- Exception: If we have a "public" (non-underscore) method that returns a
coerce map, then it should internally either explicitly create a copy or
use `coerce_map_from()`. We may think of turning some of these methods
into cached methods: If they are frequently called, copying the map each
time is bad.
--
Ticket URL: <http://trac.sagemath.org/ticket/14711#comment:181>
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.