Skip to content

Commit 218bcfe

Browse files
Kyle HofmannJon H
authored andcommitted
Ensure evaluation of polynomial is in base ring
1 parent d1f99d1 commit 218bcfe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,12 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n):
18081808
sage: S.<y> = PolynomialRing(Integers(5), implementation='NTL')
18091809
sage: f(y)
18101810
y^3 + 2
1811+
sage: f(1).parent() == R.base_ring()
1812+
True
1813+
sage: f(int(1)).parent() == R.base_ring()
1814+
True
1815+
sage: f(x + 1).parent() == f.parent()
1816+
True
18111817
"""
18121818
if len(args) != 1 or len(kwds) != 0:
18131819
return Polynomial.__call__(self, *args, **kwds)
@@ -1826,7 +1832,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n):
18261832
return Polynomial.__call__(self, *args, **kwds)
18271833
else:
18281834
ZZ_pX_eval(fx.x, self.x, x.x)
1829-
return self._parent(fx._integer_())
1835+
return self._parent._base(fx._integer_())
18301836

18311837

18321838
cdef class Polynomial_dense_mod_p(Polynomial_dense_mod_n):

0 commit comments

Comments
 (0)