File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -880,6 +880,9 @@ cdef class fmpz_mod_poly(flint_poly):
880880 """
881881 return self [0 ]
882882
883+ # XXX: Methods like leading_coefficient() that are generic should be moved
884+ # to the flint_poly base class rather than defined here.
885+
883886 def leading_coefficient (self ):
884887 """
885888 Return the leading coefficient of this polynomial.
@@ -889,6 +892,12 @@ cdef class fmpz_mod_poly(flint_poly):
889892 >>> f.leading_coefficient()
890893 fmpz_mod(3, 163)
891894 """
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()
892901 return self [self .degree()]
893902
894903 def reverse (self , degree = None ):
You can’t perform that action at this time.
0 commit comments