Bug#944648: sagemath FTBFS on i386

peter green plugwash at p10link.net
Thu Nov 28 01:09:40 GMT 2019


> All three failures give the error message
>
> OverflowError: Python int too large to convert to C long
>
> from
>
> File "sage/rings/polynomial/polynomial_integer_dense_flint.pyx", line 284, in sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint.__init__ (build/cythonized/sage/rings/polynomial/polynomial_integer_dense_flint.cpp:6548)
>          fmpz_poly_set_coeff_si(self.__poly, i, a)
>
> Help on finding a fix would be appreciated.
On line 282 of that file (assuming the version at https://github.com/sagemath/sage/blob/master/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx is the same as the one in the Debian package).

"if type(a) is int:"

If that conditional is true then the code takes a fast path, which assumes that the value of "a" fits in a C long.

In python 2 "int" was a type limited to the size of a c long, so the check was appropriate. However in python 3 "int" is an arbitrary precision type, so we need to check if it will fit in the range of a C long.

There are several other conditionals on types being "int" in the file that presumably need fixing in the same way. I also spotted a "isinstance(x0, long):" which i'm pretty sure will fail in python 3 as there is no type long in python 3.

I have attached a completely untested patch.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20191128/28c8dab2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-polynomial_integer_dense_flint-int-checks.patch
Type: text/x-patch
Size: 3634 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20191128/28c8dab2/attachment.bin>


More information about the debian-science-maintainers mailing list