Skip to content

Python bindings check fails on 32-bit #20

@dddejan

Description

@dddejan

Machine:

dejan@ubuntu-16-04-32bit:~/workspace/libpoly/build$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
dejan@ubuntu-16-04-32bit:~/workspace/libpoly/build$ uname -a
Linux ubuntu-16-04-32bit 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:19 UTC 2019 i686 i686 i686 GNU/Linux

Cmake:

cmake .. -DCMAKE_INSTALL_PREFIX=/home/dejan/install/ -DCMAKE_BUILD_TYPE=Debug -DPython_ADDITIONAL_VERSIONS=3

Error:

Running python/polynomial_resultants.py:
	* Checking Speed
	* Checking Bugs
OverflowError: Python int too large to convert to C long

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dejan/workspace/libpoly/test/check.py", line 61, in <module>
    sys.exit(main())
  File "/home/dejan/workspace/libpoly/test/check.py", line 50, in main
    forkexec(test, context)
  File "/home/dejan/workspace/libpoly/test/check.py", line 11, in forkexec
    exec(code, env, env)
  File "python/polynomial_resultants.py", line 72, in <module>
    check_psc(p, q, expected)
  File "python/polynomial_resultants.py", line 17, in check_psc
    psc = p.psc(q)
SystemError: <built-in method psc of polypy.Polynomial object at 0xb6804220> returned a result with an error set

The main issue is in

void PyLong_or_Int_to_integer(PyObject* o, lp_int_ring_t* K, lp_integer_t* c) {
where PyLong_AsLong is called without checking for overflow. Same happens in Python 2 but for some reason it doesn't throw an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions