From 90ed181ae9df152e99a652636a7e9dc29b466916 Mon Sep 17 00:00:00 2001 From: Simon King Date: Fri, 17 Jul 2015 17:29:34 +0200 Subject: [PATCH] Trivial fix for a coercion doctest --- src/sage/structure/coerce.pyx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 6545aa4d256..381784d710c 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -414,7 +414,27 @@ cdef class CoercionModel_cache_maps(CoercionModel): Now lets see what happens when we do a binary operations with an integer and a rational:: - sage: left_morphism, right_morphism = maps[ZZ, QQ] + sage: left_morphism_ref, right_morphism_ref = maps[ZZ, QQ] + + Note that by :trac:`14058` the coercion model only stores a weak + reference to the coercion maps in this case:: + + sage: left_morphism_ref + + + Moreover, the weakly referenced coercion map uses only a weak + reference to the codomain:: + + sage: left_morphism_ref() + (map internal to coercion system -- copy before use) + Natural morphism: + From: Integer Ring + To: Rational Field + + To get an actual valid map, we simply copy the weakly referenced + coercion map:: + sage: print copy(left_morphism_ref()) Natural morphism: From: Integer Ring