Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit aa040dc

Browse files
committed
Incorporate Travis' suggestions
1 parent fddb76a commit aa040dc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8968,21 +8968,26 @@ cdef class Polynomial(CommutativeAlgebraElement):
89688968
else:
89698969
raise NotImplementedError
89708970

8971-
if is_FractionField(p.parent()):
8971+
P = parent(p)
8972+
8973+
if is_FractionField(P):
89728974
if p.denominator().is_unit():
89738975
p = p.numerator()
8976+
P = parent(p)
89748977
else:
89758978
raise TypeError("The denominator should be a unit.")
89768979

89778980
if self.base_ring().has_coerce_map_from(p.parent()):
8978-
return min(c.valuation(p) for c in self.coefficients())
8981+
return min(self.get_unsafe(k).valuation(p)
8982+
for k in range(self.degree()+1)
8983+
if self.get_unsafe(k))
89798984

8980-
elif self.parent().has_coerce_map_from(p.parent()):
8981-
p = self.parent().coerce(p)
8985+
elif self._parent.has_coerce_map_from(P):
8986+
p = self._parent.coerce(p)
89828987
k = 0
89838988
while p.divides(self):
89848989
k += 1
8985-
self = self.__floordiv__(p)
8990+
self = self._floordiv_(p) # same parent
89868991
return sage.rings.integer.Integer(k)
89878992

89888993
else:

0 commit comments

Comments
 (0)