#20954: RuntimeError in coercion
---------------------------------+------------------------
       Reporter:  davidloeffler  |         Type:  defect
         Status:  new            |     Priority:  major
      Milestone:  sage-7.3       |    Component:  coercion
       Keywords:                 |    Merged in:
        Authors:                 |    Reviewers:
Report Upstream:  N/A            |  Work issues:
         Branch:                 |       Commit:
   Dependencies:                 |     Stopgaps:
---------------------------------+------------------------
 The following code crashes in Sage 7.2, with a message reporting a bug in
 the coercion model:
 {{{
 sage: R.<X> = QQ[]
 sage: F = X
 sage: S.<a> = EquationOrder(x^2 - 3)
 sage: F(X/a)
 ---------------------------------------------------------------------------
 RuntimeError                              Traceback (most recent call
 last)
 <ipython-input-20-53f01a47f657> in <module>()
 ----> 1 F(X/a)

 /usr/local/sage/sage-2/src/sage/rings/polynomial/polynomial_element.pyx in
 sage.rings.polynomial.polynomial_element.Polynomial.__div__
 
(/usr/local/sage/sage-2/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:21928)()
    1986
    1987     def __div__(self, other):
 -> 1988         return PyNumber_TrueDivide(self, other)
    1989
    1990     def __pow__(self, right, modulus):

 /usr/local/sage/sage-2/src/sage/rings/polynomial/polynomial_element.pyx in
 sage.rings.polynomial.polynomial_element.Polynomial.__truediv__
 
(/usr/local/sage/sage-2/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:21854)()
    1983         except (TypeError, ValueError):
    1984             pass
 -> 1985         return RingElement.__div__(self, right)
    1986
    1987     def __div__(self, other):

 /usr/local/sage/sage-2/src/sage/structure/element.pyx in
 sage.structure.element.RingElement.__div__
 (/usr/local/sage/sage-2/src/build/cythonized/sage/structure/element.c:17295)()
    1950         if have_same_parent_c(self, right):
    1951             return (<RingElement>self)._div_(<RingElement>right)
 -> 1952         return coercion_model.bin_op(self, right, div)
    1953
    1954     cpdef RingElement _div_(self, RingElement right):

 /usr/local/sage/sage-2/src/sage/structure/coerce.pyx in
 sage.structure.coerce.CoercionModel_cache_maps.bin_op
 (/usr/local/sage/sage-2/src/build/cythonized/sage/structure/coerce.c:8744)()
    1018             if xp is yp:
    1019                 return op(x,y)
 -> 1020             action = self.get_action(xp, yp, op, x, y)
    1021             if action is not None:
    1022                 return (<Action>action)._call_(x, y)

 /usr/local/sage/sage-2/src/sage/structure/coerce.pyx in
 sage.structure.coerce.CoercionModel_cache_maps.get_action
 (/usr/local/sage/sage-2/src/build/cythonized/sage/structure/coerce.c:15573)()
    1556             pass
    1557         action = self.discover_action(R, S, op, r, s)
 -> 1558         action = self.verify_action(action, R, S, op)
    1559         self._action_maps.set(R, S, op, action)
    1560         return action

 /usr/local/sage/sage-2/src/sage/structure/coerce.pyx in
 sage.structure.coerce.CoercionModel_cache_maps.verify_action
 (/usr/local/sage/sage-2/src/build/cythonized/sage/structure/coerce.c:16681)()
    1608
    1609             if action.left_domain() is not R or
 action.right_domain() is not S:
 -> 1610                 raise RuntimeError, """There is a BUG in the
 coercion model:
    1611                 Action found for R %s S does not have the correct
 domains
    1612                 R = %s

 RuntimeError: There is a BUG in the coercion model:
                 Action found for R <built-in function div> S does not have
 the correct domains
                 R = Univariate Polynomial Ring in X over Rational Field
                 S = Order in Number Field in a with defining polynomial
 x^2 - 3
                 (should be Univariate Polynomial Ring in X over Number
 Field in a with defining polynomial x^2 - 3, Order in Number Field in a
 with defining polynomial x^2 - 3)
                 action = Right inverse action by Number Field in a with
 defining polynomial x^2 - 3 on Univariate Polynomial Ring in X over Number
 Field in a with defining polynomial x^2 - 3
 with precomposition on right by Conversion map:
   From: Order in Number Field in a with defining polynomial x^2 - 3
   To:   Number Field in a with defining polynomial x^2 - 3 (<type
 'sage.categories.action.PrecomposedAction'>)
 }}}

--
Ticket URL: <https://trac.sagemath.org/ticket/20954>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to