#14711: Weak references in the coercion graph
-------------------------------------+-------------------------------------
Reporter: jpflori | Owner: davidloeffler
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-6.2
Component: number fields | Resolution:
Keywords: memleak, number | Merged in:
field, QuadraticField | Reviewers: Nils Bruin, Jean-
Authors: Simon King, | Pierre Flori
Travis Scrimshaw, Jean-Pierre | Work issues:
Flori | Commit:
Report Upstream: N/A | ea58b22f0bf2652e7d04b3d55e6217dcb8732cdf
Branch: | Stopgaps:
public/ticket/14711 |
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Replying to [comment:236 jpflori]:
> My problem is I don't feel we need to copy that map just to print it.
I understand that we want all our weakened maps to print a big fat
warning, since they are only safe to use when a reference to domain and
codomain is being kept. This should be guaranteed as long as the weakened
maps live in the safe environment of the coercion framework, but can not
be guaranteed if the user pulls them out of their natural environment.
Normally, the coercion framework will not print maps, hence, one will see
the big fat warning *only* if one deals with a weakened map that lives
outside of the coercion framework.
Now, back to your question: If we accept that a weakened map must provide
a big fat warning then we have to do something special when we want that a
weakened map prints as a normal map.
Options:
- Make it strong in-place. That's bad, because it may create a memory leak
on the fly.
- Use a copy. That's what the big fat warning currently suggests.
- Find a way to tell `_repr_` whether the warning shall be given or not.
I.e.: Introduce an optional parameter to `_repr_`
> And I don't get the meaning of Simon point in comment:231.
All I wanted to say is: the optional argument to `_repr_` will not save us
any effort.
> What I understood is that Travis suggested to add an optional
`suppress_warning` option to the `_repr_` method of `Morphism` set to
`False` by default.
Which I find odd.
> In the piece of code currently printing the boring warning, one would
use `%m._repr_(suppress_warning)` as we don't really care to print that
the map was using weak references.
> @Simon is it this construction that you find clumsy?
Yes.
--
Ticket URL: <http://trac.sagemath.org/ticket/14711#comment:239>
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/d/optout.