Skip to content

Commit 8c073ae

Browse files
committed
Catch a failed factorisation, using runtime error for now
The flint docs don't specify *when* this can fail so I'm not sure it fits with a DomainError or the like
1 parent a82d4ed commit 8c073ae

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/flint/types/fmpq_mpoly.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,8 @@ cdef class fmpq_mpoly(flint_mpoly):
924924
fmpq_mpoly u
925925

926926
fmpq_mpoly_factor_init(fac, self.ctx.val)
927-
fmpq_mpoly_factor(fac, self.val, self.ctx.val)
927+
if not fmpq_mpoly_factor(fac, self.val, self.ctx.val):
928+
raise RuntimeError("factorisation failed")
928929
res = [0] * fac.num
929930

930931
for i in range(fac.num):

src/flint/types/fmpz_mpoly.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,8 @@ cdef class fmpz_mpoly(flint_mpoly):
907907
fmpz_mpoly u
908908

909909
fmpz_mpoly_factor_init(fac, self.ctx.val)
910-
fmpz_mpoly_factor(fac, self.val, self.ctx.val)
910+
if not fmpz_mpoly_factor(fac, self.val, self.ctx.val):
911+
raise RuntimeError("factorisation failed")
911912
res = [0] * fac.num
912913

913914
for i in range(fac.num):

0 commit comments

Comments
 (0)