Closed
Description
The following is the output of a short session which crashes the Python interpreter. This is in version 0.7.0a5 in Python 3.12.3 on OSX Sonoma 14.1. One can raise p
to flint.fmpz(2)
and it correctly raises a ValueError
when attempting to raise p
to (-2)
. But, it crashes when attempting to raise p
to flint.fmpz(-2)
.
>>> import flint
>>> ctx = flint.fmpz_mpoly_ctx.get(('x', 2), 'lex')
>>> p = ctx.from_dict({(0, 3): 2, (2, 1): 3})
>>> p ** flint.fmpz(2)
9*x0^4*x1^2 + 12*x0^2*x1^4 + 4*x1^6
>>> p ** (-2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "flint_base.pyx", line 663, in flint.flint_base.flint_base.flint_mpoly.__pow__
ValueError: cannot raise to a negative power
>>> p ** flint.fmpz(-2)
Flint exception (General error):
Negative power in fmpz_mpoly_pow_fmpzzsh: abort python