diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 90da22b8c93..c549477bc72 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -221,7 +221,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.structure.element import Element, parent +from sage.structure.element import Element, ModuleElement, RingElement, parent from sage.structure.richcmp import op_EQ, op_NE from sage.misc.misc_c import prod from sage.arith.power import generic_power @@ -262,7 +262,7 @@ ) -class LazyModuleElement(Element): +class LazyModuleElement(ModuleElement): r""" A lazy sequence with a module structure given by term-wise addition and scalar multiplication. @@ -2928,7 +2928,7 @@ def sqrt(self): return self ** QQ((1, 2)) # == 1/2 -class LazyCauchyProductSeries(LazyModuleElement): +class LazyCauchyProductSeries(LazyModuleElement, RingElement): r""" A class for series where multiplication is the Cauchy product. @@ -2945,6 +2945,13 @@ class LazyCauchyProductSeries(LazyModuleElement): sage: f = 1 / (1 - z) sage: f 1 + z + z^2 + O(z^3) + + TESTS: + + Check creation of polynomial ring over lazy power series ring:: + + sage: R. = LazyPowerSeriesRing(QQ) + sage: T. = R[] """ def valuation(self): r""" diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index ae97f236e94..076849484b1 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -13733,6 +13733,7 @@ cpdef new_Expression(parent, x): from sage.rings.infinity import (infinity, minus_infinity, unsigned_infinity) + from sage.rings.lazy_series import LazyCauchyProductSeries from sage.structure.factorization import Factorization from sage.categories.sets_cat import Sets @@ -13757,7 +13758,8 @@ cpdef new_Expression(parent, x): return new_Expression_from_GEx(parent, g_mInfinity) elif x is unsigned_infinity: return new_Expression_from_GEx(parent, g_UnsignedInfinity) - elif isinstance(x, (RingElement, Matrix)): + elif isinstance(x, (RingElement, Matrix)) and not isinstance(x, LazyCauchyProductSeries): + # TODO allow conversion from LazyCauchyProductSeries to SR results in some mysterious bug if x.parent().characteristic(): raise TypeError('positive characteristic not allowed in symbolic computations') exp = x