From ced7bfcc760e2fb362b2a382a22a94e02f996f9b Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com> Date: Mon, 13 Apr 2015 11:10:37 +0200 Subject: [PATCH 1/3] Trac 18157: fix garbage collected objects in doctest --- src/sage/structure/coerce.pyx | 76 +++++++++++++++++---------- src/sage/structure/coerce_actions.pyx | 58 +++++++++++++------- 2 files changed, 88 insertions(+), 46 deletions(-) diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 6756c9c1b3f..3c91ee15d44 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -239,7 +239,8 @@ cdef class CoercionModel_cache_maps(CoercionModel): sage: from sage.structure.coerce import CoercionModel_cache_maps sage: cm = CoercionModel_cache_maps(4, .95) - sage: A = cm.get_action(ZZ, NumberField(x^2-2, 'a'), operator.mul) + sage: K = NumberField(x^2-2, 'a') + sage: A = cm.get_action(ZZ, K, operator.mul) sage: f, g = cm.coercion_maps(QQ, int) sage: f, g = cm.coercion_maps(ZZ, int) @@ -476,7 +477,8 @@ cdef class CoercionModel_cache_maps(CoercionModel): Result lives in Rational Field Rational Field - sage: cm.explain(ZZ['x'], QQ) + sage: R = ZZ['x'] + sage: cm.explain(R, QQ) Action discovered. Right scalar multiplication by Rational Field on Univariate Polynomial Ring in x over Integer Ring Result lives in Univariate Polynomial Ring in x over Rational Field @@ -502,10 +504,11 @@ cdef class CoercionModel_cache_maps(CoercionModel): Sometimes with non-sage types there is not enough information to deduce what will actually happen:: - sage: cm.explain(RealField(100), float, operator.add) + sage: R100 = RealField(100) + sage: cm.explain(R100, float, operator.add) Right operand is numeric, will attempt coercion in both directions. Unknown result parent. - sage: parent(RealField(100)(1) + float(1)) + sage: parent(R100(1) + float(1)) sage: cm.explain(QQ, float, operator.add) Right operand is numeric, will attempt coercion in both directions. @@ -521,7 +524,9 @@ cdef class CoercionModel_cache_maps(CoercionModel): Result lives in Rational Field Rational Field - sage: cm.explain(ZZ['x'], QQ['x'], operator.div) + sage: ZZx = ZZ['x'] + sage: QQx = QQ['x'] + sage: cm.explain(ZZx, QQx, operator.div) Coercion on left operand via Ring morphism: From: Univariate Polynomial Ring in x over Integer Ring @@ -543,7 +548,7 @@ cdef class CoercionModel_cache_maps(CoercionModel): Result lives in Rational Field Rational Field - sage: cm.explain(ZZ['x'], ZZ, operator.div) + sage: cm.explain(ZZx, ZZ, operator.div) Action discovered. Right inverse action by Rational Field on Univariate Polynomial Ring in x over Integer Ring with precomposition on right by Natural morphism: @@ -583,7 +588,8 @@ cdef class CoercionModel_cache_maps(CoercionModel): EXAMPLES:: sage: cm = sage.structure.element.get_coercion_model() - sage: steps, res = cm.analyse(GF(7), ZZ) + sage: GF7 = GF(7) + sage: steps, res = cm.analyse(GF7, ZZ) sage: print steps ['Coercion on right operand via', Natural morphism: From: Integer Ring @@ -691,23 +697,29 @@ cdef class CoercionModel_cache_maps(CoercionModel): Rational Field sage: cm.common_parent(ZZ, QQ, RR) Real Field with 53 bits of precision - sage: cm.common_parent(ZZ[['T']], QQ['T'], RDF) + sage: ZZT = ZZ[['T']] + sage: QQT = QQ['T'] + sage: cm.common_parent(ZZT, QQT, RDF) Power Series Ring in T over Real Double Field sage: cm.common_parent(4r, 5r) sage: cm.common_parent(int, float, ZZ) - sage: cm.common_parent(*[RealField(prec) for prec in [10,20..100]]) + sage: real_fields = [RealField(prec) for prec in [10,20..100]] + sage: cm.common_parent(*real_fields) Real Field with 10 bits of precision There are some cases where the ordering does matter, but if a parent can be found it is always the same:: - sage: cm.common_parent(QQ['x,y'], QQ['y,z']) == cm.common_parent(QQ['y,z'], QQ['x,y']) + sage: QQxy = QQ['x,y'] + sage: QQyz = QQ['y,z'] + sage: cm.common_parent(QQxy, QQyz) == cm.common_parent(QQyz, QQxy) True - sage: cm.common_parent(QQ['x,y'], QQ['y,z'], QQ['z,t']) + sage: QQzt = QQ['z,t'] + sage: cm.common_parent(QQxy, QQyz, QQzt) Multivariate Polynomial Ring in x, y, z, t over Rational Field - sage: cm.common_parent(QQ['x,y'], QQ['z,t'], QQ['y,z']) + sage: cm.common_parent(QQxy, QQzt, QQyz) Traceback (most recent call last): ... TypeError: no common canonical parent for objects with parents: 'Multivariate Polynomial Ring in x, y over Rational Field' and 'Multivariate Polynomial Ring in z, t over Rational Field' @@ -742,13 +754,17 @@ cdef class CoercionModel_cache_maps(CoercionModel): Rational Field sage: cm.division_parent(QQ) Rational Field - sage: cm.division_parent(ZZ['x']) + sage: ZZx = ZZ['x'] + sage: cm.division_parent(ZZx) Fraction Field of Univariate Polynomial Ring in x over Integer Ring - sage: cm.division_parent(GF(41)) + sage: K = GF(41) + sage: cm.division_parent(K) Finite Field of size 41 - sage: cm.division_parent(Integers(100)) + sage: Zmod100 = Integers(100) + sage: cm.division_parent(Zmod100) Ring of integers modulo 100 - sage: cm.division_parent(SymmetricGroup(5)) + sage: S5 = SymmetricGroup(5) + sage: cm.division_parent(S5) Symmetric group of order 5! as a permutation group """ try: @@ -1082,7 +1098,8 @@ cdef class CoercionModel_cache_maps(CoercionModel): sage: print g None - sage: f, g = cm.coercion_maps(ZZ['x'], QQ) + sage: ZZx = ZZ['x'] + sage: f, g = cm.coercion_maps(ZZx, QQ) sage: print f (map internal to coercion system -- copy before use) Ring morphism: @@ -1094,7 +1111,8 @@ cdef class CoercionModel_cache_maps(CoercionModel): From: Rational Field To: Univariate Polynomial Ring in x over Rational Field - sage: cm.coercion_maps(QQ, GF(7)) is None + sage: K = GF(7) + sage: cm.coercion_maps(QQ, K) is None True Note that to break symmetry, if there is a coercion map in both @@ -1248,7 +1266,8 @@ cdef class CoercionModel_cache_maps(CoercionModel): Otherwise, try and compute an appropriate cover:: - sage: cm.discover_coercion(ZZ['x,y'], RDF) + sage: ZZxy = ZZ['x,y'] + sage: cm.discover_coercion(ZZxy, RDF) ((map internal to coercion system -- copy before use) Call morphism: From: Multivariate Polynomial Ring in x, y over Integer Ring @@ -1307,24 +1326,26 @@ cdef class CoercionModel_cache_maps(CoercionModel): EXAMPLES:: sage: cm = sage.structure.element.get_coercion_model() - sage: cm.get_action(ZZ['x'], ZZ, operator.mul) + sage: ZZx = ZZ['x'] + sage: cm.get_action(ZZx, ZZ, operator.mul) Right scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring - sage: cm.get_action(ZZ['x'], ZZ, operator.imul) + sage: cm.get_action(ZZx, ZZ, operator.imul) Right scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring - sage: cm.get_action(ZZ['x'], QQ, operator.mul) + sage: cm.get_action(ZZx, QQ, operator.mul) Right scalar multiplication by Rational Field on Univariate Polynomial Ring in x over Integer Ring - sage: cm.get_action(QQ['x'], int, operator.mul) + sage: QQx = QQ['x'] + sage: cm.get_action(QQx, int, operator.mul) Right scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Rational Field with precomposition on right by Native morphism: From: Set of Python objects of type 'int' To: Integer Ring - sage: R. = QQ['x'] - sage: A = cm.get_action(R, ZZ, operator.div); A + sage: A = cm.get_action(QQx, ZZ, operator.div); A Right inverse action by Rational Field on Univariate Polynomial Ring in x over Rational Field with precomposition on right by Natural morphism: From: Integer Ring To: Rational Field + sage: x = QQx.gen() sage: A(x+10, 5) 1/5*x + 2 @@ -1449,12 +1470,13 @@ cdef class CoercionModel_cache_maps(CoercionModel): Bug :trac:`17740`:: - sage: cm.discover_action(GF(5)['x'], ZZ, operator.div) + sage: R = GF(5)['x'] + sage: cm.discover_action(R, ZZ, operator.div) Right inverse action by Finite Field of size 5 on Univariate Polynomial Ring in x over Finite Field of size 5 with precomposition on right by Natural morphism: From: Integer Ring To: Finite Field of size 5 - sage: cm.bin_op(GF(5)['x'].gen(), 7, operator.div).parent() + sage: cm.bin_op(R.gen(), 7, operator.div).parent() Univariate Polynomial Ring in x over Finite Field of size 5 """ #print "looking", R, R, op, S, S diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx index ead12a687b0..0adb72e1969 100644 --- a/src/sage/structure/coerce_actions.pyx +++ b/src/sage/structure/coerce_actions.pyx @@ -65,17 +65,19 @@ cdef class GenericAction(Action): """ TESTS:: - sage: sage.structure.coerce_actions.ActedUponAction(MatrixSpace(ZZ, 2), Cusps, True) + sage: M = MatrixSpace(ZZ,2) + sage: sage.structure.coerce_actions.ActedUponAction(M, Cusps, True) Left action by Full MatrixSpace of 2 by 2 dense matrices over Integer Ring on Set P^1(QQ) of all cusps - sage: sage.structure.coerce_actions.GenericAction(QQ, Zmod(6), True) + sage: Z6 = Zmod(6) + sage: sage.structure.coerce_actions.GenericAction(QQ, Z6, True) Traceback (most recent call last): ... NotImplementedError: Action not implemented. This will break if we tried to use it:: - sage: sage.structure.coerce_actions.GenericAction(QQ, Zmod(6), True, check=False) + sage: sage.structure.coerce_actions.GenericAction(QQ, Z6, True, check=False) Left action by Rational Field on Ring of integers modulo 6 """ @@ -94,10 +96,14 @@ cdef class GenericAction(Action): EXAMPLES:: - sage: A = sage.structure.coerce_actions.ActedUponAction(MatrixSpace(ZZ, 2), Cusps, True) + sage: M = MatrixSpace(ZZ,2) + sage: A = sage.structure.coerce_actions.ActedUponAction(M, Cusps, True) sage: A.codomain() Set P^1(QQ) of all cusps - sage: A = sage.structure.coerce_actions.ActOnAction(SymmetricGroup(3), QQ['x,y,z'], False) + + sage: S3 = SymmetricGroup(3) + sage: QQxyz = QQ['x,y,z'] + sage: A = sage.structure.coerce_actions.ActOnAction(S3, QQxyz, False) sage: A.codomain() Multivariate Polynomial Ring in x, y, z over Rational Field """ @@ -139,7 +145,8 @@ cdef class ActedUponAction(GenericAction): """ TESTS:: - sage: A = sage.structure.coerce_actions.ActedUponAction(MatrixSpace(ZZ, 2), Cusps, True) + sage: M = MatrixSpace(ZZ,2) + sage: A = sage.structure.coerce_actions.ActedUponAction(M, Cusps, True) sage: A.act(matrix(ZZ, 2, [1,0,2,-1]), Cusp(1,2)) Infinity sage: A._call_(matrix(ZZ, 2, [1,0,2,-1]), Cusp(1,2)) @@ -160,13 +167,15 @@ def detect_element_action(Parent X, Y, bint X_on_left, X_el=None, Y_el=None): EXAMPLES:: sage: from sage.structure.coerce_actions import detect_element_action - sage: detect_element_action(ZZ['x'], ZZ, False) + sage: ZZx = ZZ['x'] + sage: M = MatrixSpace(ZZ,2) + sage: detect_element_action(ZZx, ZZ, False) Left scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring - sage: detect_element_action(ZZ['x'], QQ, True) + sage: detect_element_action(ZZx, QQ, True) Right scalar multiplication by Rational Field on Univariate Polynomial Ring in x over Integer Ring - sage: detect_element_action(Cusps, MatrixSpace(ZZ, 2), False) + sage: detect_element_action(Cusps, M, False) Left action by Full MatrixSpace of 2 by 2 dense matrices over Integer Ring on Set P^1(QQ) of all cusps - sage: detect_element_action(Cusps, MatrixSpace(ZZ, 2), True), + sage: detect_element_action(Cusps, M, True), (None,) sage: detect_element_action(ZZ, QQ, True), (None,) @@ -266,13 +275,17 @@ cdef class ModuleAction(Action): EXAMPLES:: sage: from sage.structure.coerce_actions import LeftModuleAction - sage: LeftModuleAction(ZZ, ZZ['x']) + sage: ZZx = ZZ['x'] + sage: QQx = QQ['x'] + sage: QQy = QQ['y'] + sage: ZZxy = ZZ['x']['y'] + sage: LeftModuleAction(ZZ, ZZx) Left scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring - sage: LeftModuleAction(ZZ, QQ['x']) + sage: LeftModuleAction(ZZ, QQx) Left scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Rational Field - sage: LeftModuleAction(QQ, ZZ['x']) + sage: LeftModuleAction(QQ, ZZx) Left scalar multiplication by Rational Field on Univariate Polynomial Ring in x over Integer Ring - sage: LeftModuleAction(QQ, ZZ['x']['y']) + sage: LeftModuleAction(QQ, ZZxy) Left scalar multiplication by Rational Field on Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Integer Ring The following tests against a problem that was relevant during work on @@ -351,11 +364,15 @@ cdef class ModuleAction(Action): EXAMPLES:: sage: from sage.structure.coerce_actions import LeftModuleAction, RightModuleAction - sage: A = LeftModuleAction(ZZ, ZZ['x']); A + sage: ZZx = ZZ['x'] + sage: A = LeftModuleAction(ZZ, ZZx); A Left scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring sage: A._repr_name_() 'scalar multiplication' - sage: RightModuleAction(GF(5), GF(5)[['t']]) + + sage: GF5 = GF(5) + sage: GF5t = GF5[['t']] + sage: RightModuleAction(GF5, GF5t) Right scalar multiplication by Finite Field of size 5 on Power Series Ring in t over Finite Field of size 5 """ return "scalar multiplication" @@ -587,7 +604,8 @@ cdef class IntegerMulAction(Action): EXAMPLES:: sage: from sage.structure.coerce_actions import IntegerMulAction - sage: act = IntegerMulAction(ZZ, GF(101)) + sage: GF101 = GF(101) + sage: act = IntegerMulAction(ZZ, GF101) sage: act(3, 9) 27 sage: act(3^689, 9) @@ -606,7 +624,8 @@ cdef class IntegerMulAction(Action): This used to hang before :trac:`17844`:: - sage: E = EllipticCurve(GF(5), [4,0]) + sage: GF5 = GF(5) + sage: E = EllipticCurve(GF5, [4,0]) sage: P = E.random_element() sage: (-2^63)*P (0 : 1 : 0) @@ -644,7 +663,8 @@ cdef class IntegerMulAction(Action): EXAMPLES:: sage: from sage.structure.coerce_actions import IntegerMulAction - sage: IntegerMulAction(ZZ, GF(5)) + sage: GF5 = GF(5) + sage: IntegerMulAction(ZZ, GF5) Left Integer Multiplication by Integer Ring on Finite Field of size 5 """ return "Integer Multiplication" From ef3bb5d985ee65e46d89277a3833af40953bc59c Mon Sep 17 00:00:00 2001 From: Simon King Date: Fri, 17 Apr 2015 19:54:48 +0200 Subject: [PATCH 2/3] Add a warning not to use coerce actions outside of the coercion model --- src/sage/structure/coerce_actions.pyx | 103 ++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 16 deletions(-) diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx index 0adb72e1969..c11928b3c29 100644 --- a/src/sage/structure/coerce_actions.pyx +++ b/src/sage/structure/coerce_actions.pyx @@ -63,7 +63,12 @@ cdef class GenericAction(Action): def __init__(self, Parent G, S, is_left, bint check=True): """ - TESTS:: + TESTS: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: M = MatrixSpace(ZZ,2) sage: sage.structure.coerce_actions.ActedUponAction(M, Cusps, True) @@ -94,7 +99,13 @@ cdef class GenericAction(Action): result elements live. Typically, this should be the same as the acted upon set. - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, for + otherwise they could be garbage collected, giving rise to random + errors. :: + sage: M = MatrixSpace(ZZ,2) sage: A = sage.structure.coerce_actions.ActedUponAction(M, Cusps, True) @@ -106,6 +117,7 @@ cdef class GenericAction(Action): sage: A = sage.structure.coerce_actions.ActOnAction(S3, QQxyz, False) sage: A.codomain() Multivariate Polynomial Ring in x, y, z over Rational Field + """ if self._codomain is None: self._codomain = parent_c(self.act(an_element(self.G), @@ -164,7 +176,12 @@ def detect_element_action(Parent X, Y, bint X_on_left, X_el=None, Y_el=None): r""" Returns an action of X on Y or Y on X as defined by elements X, if any. - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import detect_element_action sage: ZZx = ZZ['x'] @@ -272,7 +289,12 @@ cdef class ModuleAction(Action): base ring. The simplest example to keep in mind is R acting on the polynomial ring R[x]. - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import LeftModuleAction sage: ZZx = ZZ['x'] @@ -361,7 +383,12 @@ cdef class ModuleAction(Action): """ The default name of this action type, which is has a sane default. - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the + coercion model. For this test, we need to strongly reference the + domains, for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import LeftModuleAction, RightModuleAction sage: ZZx = ZZ['x'] @@ -374,6 +401,7 @@ cdef class ModuleAction(Action): sage: GF5t = GF5[['t']] sage: RightModuleAction(GF5, GF5t) Right scalar multiplication by Finite Field of size 5 on Power Series Ring in t over Finite Field of size 5 + """ return "scalar multiplication" @@ -381,10 +409,16 @@ cdef class ModuleAction(Action): """ The codomain of self, which may or may not be equal to the domain. - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import LeftModuleAction - sage: A = LeftModuleAction(QQ, ZZ['x,y,z']) + sage: ZZxyz = ZZ['x,y,z'] + sage: A = LeftModuleAction(QQ, ZZxyz) sage: A.codomain() Multivariate Polynomial Ring in x, y, z over Rational Field """ @@ -396,10 +430,16 @@ cdef class ModuleAction(Action): """ The domain of self, which is the module that is being acted on. - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import LeftModuleAction - sage: A = LeftModuleAction(QQ, ZZ['x,y,z']) + sage: ZZxyz = ZZ['x,y,z'] + sage: A = LeftModuleAction(QQ, ZZxyz) sage: A.domain() Multivariate Polynomial Ring in x, y, z over Integer Ring """ @@ -407,7 +447,12 @@ cdef class ModuleAction(Action): def __invert__(self): """ - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, for + otherwise they could be garbage collected, giving rise to random + errors. :: sage: from sage.structure.coerce_actions import RightModuleAction @@ -499,7 +544,12 @@ cdef class LeftModuleAction(ModuleAction): first argument (the left side) and the module element as the second argument (the right side). - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import LeftModuleAction sage: R. = QQ['x'] @@ -531,7 +581,12 @@ cdef class RightModuleAction(ModuleAction): first argument (the left side) and the ring element as the second argument (the right side). - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the domains, + for otherwise they could be garbage collected, giving rise to + random errors. :: sage: from sage.structure.coerce_actions import RightModuleAction sage: R. = QQ['x'] @@ -573,6 +628,12 @@ cdef class IntegerMulAction(Action): Both addition and negation must be defined on the set `M`. + NOTE: + + This class is used internally in Sage's coercion model. Outside of the + coercion model, special precautions are needed to prevent domains of + the action from being garbage collected. + INPUT: - An integer ring, ``ZZ`` @@ -601,7 +662,12 @@ cdef class IntegerMulAction(Action): cpdef _call_(self, nn, a): """ - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the field + ``GF(101)``, for otherwise it could be garbage collected, giving rise + to random errors. :: sage: from sage.structure.coerce_actions import IntegerMulAction sage: GF101 = GF(101) @@ -624,8 +690,7 @@ cdef class IntegerMulAction(Action): This used to hang before :trac:`17844`:: - sage: GF5 = GF(5) - sage: E = EllipticCurve(GF5, [4,0]) + sage: E = EllipticCurve(GF(5), [4,0]) sage: P = E.random_element() sage: (-2^63)*P (0 : 1 : 0) @@ -636,6 +701,7 @@ cdef class IntegerMulAction(Action): Traceback (most recent call last): ... AlarmInterrupt + """ if not self._is_left: a, nn = nn, a @@ -660,7 +726,12 @@ cdef class IntegerMulAction(Action): def _repr_name_(self): """ - EXAMPLES:: + EXAMPLES: + + Note that coerce actions should only be used inside of the coercion + model. For this test, we need to strongly reference the field + ``GF(5)``, for otherwise it could be garbage collected, giving rise + to random errors. :: sage: from sage.structure.coerce_actions import IntegerMulAction sage: GF5 = GF(5) From 60fcedce48b8237353e72315976ed24ab7c236ca Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com> Date: Sat, 18 Apr 2015 00:32:14 +0200 Subject: [PATCH 3/3] Trac 18157: adding reference to the trac ticket --- src/sage/structure/coerce_actions.pyx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx index 87d8d7576ed..34fa435ff52 100644 --- a/src/sage/structure/coerce_actions.pyx +++ b/src/sage/structure/coerce_actions.pyx @@ -67,7 +67,7 @@ cdef class GenericAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: M = MatrixSpace(ZZ,2) sage: sage.structure.coerce_actions.ActedUponAction(M, Cusps, True) @@ -103,7 +103,7 @@ cdef class GenericAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to random - errors. :: + errors (see :trac:`18157`). :: sage: M = MatrixSpace(ZZ,2) @@ -180,7 +180,7 @@ def detect_element_action(Parent X, Y, bint X_on_left, X_el=None, Y_el=None): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import detect_element_action sage: ZZx = ZZ['x'] @@ -293,7 +293,8 @@ cdef class ModuleAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: + sage: from sage.structure.coerce_actions import LeftModuleAction sage: ZZx = ZZ['x'] @@ -387,7 +388,7 @@ cdef class ModuleAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import LeftModuleAction, RightModuleAction sage: ZZx = ZZ['x'] @@ -413,7 +414,7 @@ cdef class ModuleAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import LeftModuleAction sage: ZZxyz = ZZ['x,y,z'] @@ -434,7 +435,7 @@ cdef class ModuleAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import LeftModuleAction sage: ZZxyz = ZZ['x,y,z'] @@ -451,7 +452,7 @@ cdef class ModuleAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to random - errors. :: + errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import RightModuleAction @@ -548,7 +549,7 @@ cdef class LeftModuleAction(ModuleAction): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import LeftModuleAction sage: R. = QQ['x'] @@ -585,7 +586,7 @@ cdef class RightModuleAction(ModuleAction): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the domains, for otherwise they could be garbage collected, giving rise to - random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import RightModuleAction sage: R. = QQ['x'] @@ -666,7 +667,7 @@ cdef class IntegerMulAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the field ``GF(101)``, for otherwise it could be garbage collected, giving rise - to random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import IntegerMulAction sage: GF101 = GF(101) @@ -730,7 +731,7 @@ cdef class IntegerMulAction(Action): Note that coerce actions should only be used inside of the coercion model. For this test, we need to strongly reference the field ``GF(5)``, for otherwise it could be garbage collected, giving rise - to random errors. :: + random errors (see :trac:`18157`). :: sage: from sage.structure.coerce_actions import IntegerMulAction sage: GF5 = GF(5)