Skip to content

Python3 compatibility #888

@nim65s

Description

@nim65s

Hi,

I got this compilation error, on a Raspberry Pi with ArchLinux ARM (as Raspbian has a version of Qt5 that is too old):

/home/alarm/aseba/enki/python/enki.cpp: In static member function 'static void* Vector_from_python::convertible(PyObject*)':
/home/alarm/aseba/enki/python/enki.cpp:108:34: error: 'PyInt_Check' was not declared in this scope
    if (!(PyFloat_Check(item0) || PyInt_Check(item0)))
                                  ^~~~~~~~~~~
/home/alarm/aseba/enki/python/enki.cpp:108:34: note: suggested alternative: 'PySet_Check'
    if (!(PyFloat_Check(item0) || PyInt_Check(item0)))
                                  ^~~~~~~~~~~
                                  PySet_Check
/home/alarm/aseba/enki/python/enki.cpp:112:34: error: 'PyInt_Check' was not declared in this scope
    if (!(PyFloat_Check(item1) || PyInt_Check(item1)))
                                  ^~~~~~~~~~~
/home/alarm/aseba/enki/python/enki.cpp:112:34: note: suggested alternative: 'PySet_Check'
    if (!(PyFloat_Check(item1) || PyInt_Check(item1)))
                                  ^~~~~~~~~~~
                                  PySet_Check
/home/alarm/aseba/enki/python/enki.cpp:123:34: error: 'PyInt_Check' was not declared in this scope
    if (!(PyFloat_Check(item0) || PyInt_Check(item0)))
                                  ^~~~~~~~~~~
/home/alarm/aseba/enki/python/enki.cpp:123:34: note: suggested alternative: 'PySet_Check'
    if (!(PyFloat_Check(item0) || PyInt_Check(item0)))
                                  ^~~~~~~~~~~
                                  PySet_Check
/home/alarm/aseba/enki/python/enki.cpp:127:34: error: 'PyInt_Check' was not declared in this scope
    if (!(PyFloat_Check(item1) || PyInt_Check(item1)))
                                  ^~~~~~~~~~~
/home/alarm/aseba/enki/python/enki.cpp:127:34: note: suggested alternative: 'PySet_Check'
    if (!(PyFloat_Check(item1) || PyInt_Check(item1)))
                                  ^~~~~~~~~~~
                                  PySet_Check

So it seems that this package is not yet compatible with Python 3, right ?

Therefore, I suggest either to make it compatible, or to raise an issue in CMake if PYTHON_VERSION_MAJOR > 2.

Also, this could be documented, and adding -DPYTHON_EXECUTABLE=$(which python2) should be enough to workaround this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions