#15303: Coercion discovery fails to be transitive
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.0
Component: coercion | Resolution:
Keywords: | Merged in:
Authors: Simon King | Reviewers:
Report Upstream: N/A | Work issues: Crash in permgroup.py
Branch: | Commit:
u/SimonKing/ticket/15303 | 528a03535447d67f04dc16d0a22cc38def54f9f1
Dependencies: #14711, #15329, | Stopgaps:
#15331 |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
How can I see what you did? I tried `git diff HEAD^2`, but it doesn't
really look like what I expected from resolving a merge conflict, since it
touches stuff that did not conflict.
{{{
diff --git a/src/doc/en/reference/coercion/index.rst
b/src/doc/en/reference/coercion/index.rst
index 933098a..e72339e 100644
--- a/src/doc/en/reference/coercion/index.rst
+++ b/src/doc/en/reference/coercion/index.rst
@@ -269,8 +269,21 @@ discovered between steps 1 and 2 above.
sage: f = QQ.coerce_map_from(ZZ)
sage: f(3).parent()
Rational Field
+
+Note that by :trac:`14711` Sage's coercion system uses maps with weak
+references to the domain. Such maps should only be used internally, and
so a
+copy should be used instead (unless one knows what one is doing)::
+
sage: QQ.coerce_map_from(int)
Native morphism:
+ From: Set of Python objects of type 'int'
+ To: Rational Field
+ <BLANKLINE>
+ WARNING: This morphism has apparently been used internally
+ in the coercion system. It may become defunct in the next
+ garbage collection. Please use a copy.
+ sage: copy(QQ.coerce_map_from(int))
+ Native morphism:
From: Set of Python objects of type 'int'
To: Rational Field
sage: QQ.has_coerce_map_from(RR)
diff --git a/src/doc/en/thematic_tutorials/coercion_and_categories.rst
b/src/doc/en/thematic_tutorials/coercion_and_categories.rst
index 1a31e7a..fd38034 100644
--- a/src/doc/en/thematic_tutorials/coercion_and_categories.rst
+++ b/src/doc/en/thematic_tutorials/coercion_and_categories.rst
@@ -750,15 +750,19 @@ thus have::
sage: P1.has_coerce_map_from(P2)
True
- sage: P1.coerce_map_from(P2)
+ sage: copy(P1.coerce_map_from(P2))
Call morphism:
From: Multivariate Polynomial Ring in w, v over Integer Ring
To: Multivariate Polynomial Ring in v, w over Rational Field
+Note that we used a copy of the coerce map because of :trac:`14711`:
Sage's
+coercion system internally uses maps with weak references to their
domain, and
+only copies of such maps should be used outside of the coercion system.
etc. pp.
}}}
Or is `git diff HEAD^2` not the right thing to do in order to see your
changes?
--
Ticket URL: <http://trac.sagemath.org/ticket/15303#comment:111>
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.