diff --git a/src/sage/rings/polynomial/multi_polynomial.pyx b/src/sage/rings/polynomial/multi_polynomial.pyx index e5686323bb1..aa43959394c 100644 --- a/src/sage/rings/polynomial/multi_polynomial.pyx +++ b/src/sage/rings/polynomial/multi_polynomial.pyx @@ -1802,7 +1802,7 @@ cdef class MPolynomial(CommutativeRingElement): u = self.base_ring()(f.unit()) if u.is_one(): - ans = u + ans = self.parent().one() else: # try to compute a n-th root of the unit in the # base ring. the `nth_root` method thus has to be diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index fb2d6dd812f..5f52f932ce3 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -7827,6 +7827,12 @@ cdef class Polynomial(CommutativeAlgebraElement): 13*x - 7 sage: b^3 == a True + + TESTS:: + + sage: R. = ZZ[] + sage: parent(R.one().nth_root(3)) + Univariate Polynomial Ring in x over Integer Ring """ # note: this code is duplicated in # sage.rings.polynomial.multi_polynomial.MPolynomial.nth_root @@ -7845,7 +7851,7 @@ cdef class Polynomial(CommutativeAlgebraElement): u = self.base_ring()(f.unit()) if u.is_one(): - ans = u + ans = self.parent().one() else: # try to compute a n-th root of the unit in the # base ring. the `nth_root` method thus has to be