File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -3281,6 +3281,7 @@ def factor(p):
32813281
32823282 assert factor (0 * x ) == (S (0 ), [])
32833283 assert factor (0 * x + 1 ) == (S (1 ), [])
3284+ assert factor (0 * x + 3 ) == (S (3 ), [])
32843285 assert factor (x ) == (S (1 ), [(x , 1 )])
32853286 assert factor (- x ) == (S (- 1 ), [(x , 1 )])
32863287 assert factor (x ** 2 ) == (S (1 ), [(x , 2 )])
Original file line number Diff line number Diff line change @@ -1803,11 +1803,14 @@ cdef class fmpz_mod_poly(flint_poly):
18031803 # Exception (fmpz_mod_poly_powmod_fmpz_binexp). Divide by zero
18041804 #
18051805 # We handle this special case first:
1806- cdef fmpz_mod zero
1807- if self .is_zero():
1808- zero = fmpz_mod.__new__ (fmpz_mod)
1809- zero.ctx = self .ctx.mod
1810- return (zero, [])
1806+ cdef fmpz_mod constant
1807+ if self .is_constant():
1808+ if self .is_zero():
1809+ constant = fmpz_mod.__new__ (fmpz_mod)
1810+ constant.ctx = self .ctx.mod
1811+ else :
1812+ constant = self [0 ]
1813+ return (constant, [])
18111814
18121815 fmpz_mod_poly_factor_init(fac, self .ctx.mod.val)
18131816 if algorithm == None :
You can’t perform that action at this time.
0 commit comments