diff --git a/src/doc/en/thematic_tutorials/coercion_and_categories.rst b/src/doc/en/thematic_tutorials/coercion_and_categories.rst index edd89ad3c42..afa83bfa754 100644 --- a/src/doc/en/thematic_tutorials/coercion_and_categories.rst +++ b/src/doc/en/thematic_tutorials/coercion_and_categories.rst @@ -837,7 +837,7 @@ The four axioms requested for coercions sage: ZZ(P2.gen(1)) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: v is not a constant polynomial Hence, we only have a *partial* map. This is fine for a *conversion*, but a partial map does not qualify as a *coercion*. diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 5379dbda101..c38f7af4d7d 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -149,7 +149,7 @@ cdef class Action(Functor): sage: A(x, 5) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: x is not a constant polynomial sage: A = IntegerMulAction(ZZ, R, False) # Right action sage: A(x, 5) 5*x @@ -158,7 +158,7 @@ cdef class Action(Functor): sage: A(5, x) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: x is not a constant polynomial """ if len(args) == 2: # Normal case, called with (g, x) or (x, g) as arguments diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index c814bd2d8ff..2767beda5db 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -2088,7 +2088,7 @@ cdef class FormalCompositeMap(Map): sage: ZZ(3*x + 45) # indirect doctest Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: 3*x + 45 is not a constant polynomial """ sections = [] for m in reversed(list(self)): diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index 2a1fe2dd117..182279678d4 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -1333,7 +1333,7 @@ def _from_dict(self, d, coerce=True, remove_zeros=True): sage: A._from_dict(d, coerce=True) # needs sage.modules Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: y is not a constant polynomial """ R = self.base_ring() B = self.basis() diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 56a32dea180..afa2e6653e7 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -6636,7 +6636,7 @@ def _apply_functor(self, R): sage: F(QQ) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: t is not a constant polynomial """ from sage.combinat.sf.sf import SymmetricFunctions return self._basis(self._family(SymmetricFunctions(R), *self._args)) diff --git a/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py b/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py index 540f633d545..d59d0df6b9f 100644 --- a/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py +++ b/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py @@ -698,7 +698,7 @@ def orbit(self, p, n): sage: d.orbit(2, x) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: x is not a constant polynomial :: diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx index e1dd532b21a..724e1ca1c4e 100644 --- a/src/sage/matrix/matrix1.pyx +++ b/src/sage/matrix/matrix1.pyx @@ -1926,7 +1926,7 @@ cdef class Matrix(Matrix0): sage: D = A.augment(B) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: y is not a constant polynomial sage: E = A.change_ring(R) sage: F = E.augment(B); F diff --git a/src/sage/rings/polynomial/ore_function_element.py b/src/sage/rings/polynomial/ore_function_element.py index 2f74a939c6b..e560053b176 100644 --- a/src/sage/rings/polynomial/ore_function_element.py +++ b/src/sage/rings/polynomial/ore_function_element.py @@ -709,13 +709,13 @@ def _call_(self, x): sage: F(g) # needs sage.rings.function_field Traceback (most recent call last): ... - TypeError: not a constant function + TypeError: (x + t^2)^(-1) * x is not a constant function """ numerator = x._numerator denominator = x._denominator if numerator.degree() == denominator.degree() and denominator.right_divides(numerator): return numerator.leading_coefficient() / denominator.leading_coefficient() - raise TypeError("not a constant function") + raise TypeError(f"{x} is not a constant function") class OreFunctionBaseringInjection(Morphism): r""" diff --git a/src/sage/rings/polynomial/ore_polynomial_element.pyx b/src/sage/rings/polynomial/ore_polynomial_element.pyx index 7cf35766986..2ddf54c26ed 100644 --- a/src/sage/rings/polynomial/ore_polynomial_element.pyx +++ b/src/sage/rings/polynomial/ore_polynomial_element.pyx @@ -3011,7 +3011,7 @@ cdef class ConstantOrePolynomialSection(Map): sage: m(S([0,1])-S([0,t])) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: (-t + 1)*x is not a constant polynomial """ if x.degree() <= 0: try: @@ -3019,7 +3019,7 @@ cdef class ConstantOrePolynomialSection(Map): except AttributeError: return ((x).constant_coefficient()) else: - raise TypeError("not a constant polynomial") + raise TypeError(f"{x} is not a constant polynomial") cdef class OrePolynomialBaseringInjection(Morphism): diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 0c49f638fcf..ce6a1be623c 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -1476,7 +1476,7 @@ cdef class Polynomial(CommutativePolynomial): sage: QQ(3*x + 45) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: 3*x + 45 is not a constant polynomial """ return self._scalar_conversion(sage.rings.rational.Rational) @@ -12894,7 +12894,7 @@ cdef class ConstantPolynomialSection(Map): sage: phi(y_1) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: y_1 is not a constant polynomial """ cpdef Element _call_(self, x): """ @@ -12913,7 +12913,7 @@ cdef class ConstantPolynomialSection(Map): sage: m(x) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: x is not a constant polynomial """ if x.degree() <= 0: try: @@ -12921,7 +12921,7 @@ cdef class ConstantPolynomialSection(Map): except AttributeError: return ((x).constant_coefficient()) else: - raise TypeError("not a constant polynomial") + raise TypeError(f"{x} is not a constant polynomial") cdef class PolynomialBaseringInjection(Morphism): """ diff --git a/src/sage/rings/polynomial/polynomial_zz_pex.pyx b/src/sage/rings/polynomial/polynomial_zz_pex.pyx index 006953f182f..fd89f7a9956 100644 --- a/src/sage/rings/polynomial/polynomial_zz_pex.pyx +++ b/src/sage/rings/polynomial/polynomial_zz_pex.pyx @@ -100,7 +100,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template): sage: R([3,x]) Traceback (most recent call last): ... - TypeError: not a constant polynomial + TypeError: x is not a constant polynomial Check that NTL contexts are correctly restored and that :issue:`9524` has been fixed::