In `python-flint==0.4.4`. ```python >>> from flint import fmpz >>> pow(2, 5, 1000) 32 >>> pow(2, 5, fmpz(1000)) 1 >>> pow(2, fmpz(5), fmpz(1000)) 32 ```
Activity
oscarbenjamin commentedon Oct 2, 2023
Looks like the code here should be checking the type of
s:python-flint/src/flint/types/fmpz.pyx
Lines 362 to 371 in 98c2883
I hadn't contemplated that
__pow__(s, t, m)might be called withsnot being anfmpz. At this lineswill be anint(PyLong):python-flint/src/flint/types/fmpz.pyx
Line 405 in 98c2883
Presumably the bytes there look like a 1 as an fmpz_t.
The fix is that the s argument should be handled in the same way as the t argument.
oscarbenjamin commentedon Oct 2, 2023
Thanks for the bug report. This will be fixed in the next release.
haru-44 commentedon Oct 2, 2023
Thanks for the correction.
# int() can be removed when flintlib/python-flint#92