File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -880,6 +880,9 @@ cdef class fmpz_mod_poly(flint_poly):
880
880
"""
881
881
return self [0 ]
882
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
+
883
886
def leading_coefficient (self ):
884
887
"""
885
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()
892
901
return self [self .degree()]
893
902
894
903
def reverse (self , degree = None ):
You can’t perform that action at this time.
0 commit comments