We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad97112 commit a068011Copy full SHA for a068011
src/flint/types/fmpz_mod_poly.pyx
@@ -880,6 +880,9 @@ cdef class fmpz_mod_poly(flint_poly):
880
"""
881
return self[0]
882
883
+ # XXX: Methods like leading_coefficient() that are generic should be moved
884
+ # to the flint_poly base class rather than defined here.
885
+
886
def leading_coefficient(self):
887
888
Return the leading coefficient of this polynomial.
@@ -889,6 +892,12 @@ cdef class fmpz_mod_poly(flint_poly):
889
892
>>> f.leading_coefficient()
890
893
fmpz_mod(3, 163)
891
894
895
+ # XXX: This is a workaround for a Cython/PyPy bug:
896
+ # https://github.com/flintlib/python-flint/issues/74
897
+ # https://github.com/cython/cython/issues/5776
898
+ d = self.degree()
899
+ if d < 0:
900
+ return self.ctx.mod.zero()
901
return self[self.degree()]
902
903
def reverse(self, degree=None):
0 commit comments