From d628f1459d21ecd34c14366336a7b56fc677b78c Mon Sep 17 00:00:00 2001 From: Salvatore Stella Date: Tue, 25 Dec 2018 20:09:34 +0100 Subject: [PATCH] Fix 26958 --- .../rings/polynomial/multi_polynomial_ring_base.pxd | 2 ++ .../rings/polynomial/multi_polynomial_ring_base.pyx | 11 +++++++++++ src/sage/rings/polynomial/polynomial_element.pyx | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd b/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd index 7e713c01dac..87738032ad6 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd @@ -1,7 +1,9 @@ cimport sage.rings.ring from sage.structure.parent cimport Parent +from cpython cimport bool cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): + cdef public bool _no_generic_basering_coercion cdef object __ngens cdef object __term_order cdef public object _has_singular diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index ee76f34c922..fdd4ce930ea 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -63,6 +63,14 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): True sage: A1(a) in A2 True + + Check that :trac:`26958` is fixed:: + + sage: from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomialRing_libsingular + sage: class Foo(MPolynomialRing_libsingular): + ....: pass + sage: Foo(QQ, 2, ['x','y'], 'degrevlex') + Multivariate Polynomial Ring in x, y over Rational Field """ if base_ring not in _CommutativeRings: raise TypeError("The base ring %s is not a commutative ring" % base_ring) @@ -85,6 +93,9 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): else: category = polynomial_default_category(base_ring.category(), n) + # Avoid calling __init_extra__ of Algebras(...).parent_class + self._no_generic_basering_coercion = True + sage.rings.ring.Ring.__init__(self, base_ring, names, category=category) def is_integral_domain(self, proof = True): diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 840810f42e5..aeb57b27fb5 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -11496,7 +11496,7 @@ cdef class PolynomialBaseringInjection(Morphism): By :trac:`9944`, there are now only very few exceptions:: sage: PolynomialRing(QQ,names=[]).coerce_map_from(QQ) - Generic morphism: + Call morphism: From: Rational Field To: Multivariate Polynomial Ring in no variables over Rational Field """