Skip to content

Fails to build on Python 3 with errors about PyInt_AS_LONG (with certain compiler options) #10

@jamadden

Description

@jamadden

The compiler produces these errors:

    zopyx/txng3/ext/python-Levenshtein-0.10/Levenshtein.c:1374:27: error: implicit declaration of function 'PyInt_AS_LONG' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ops[i].spos = (size_t)PyInt_AS_LONG(item);
                              ^
    zopyx/txng3/ext/python-Levenshtein-0.10/Levenshtein.c:1416:28: error: implicit declaration of function 'PyInt_AS_LONG' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        bops[i].sbeg = (size_t)PyInt_AS_LONG(item);
                               ^
    zopyx/txng3/ext/python-Levenshtein-0.10/Levenshtein.c:1487:20: error: implicit declaration of function 'PyInt_AS_LONG' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        long int len = PyInt_AS_LONG(object);

PyInt_AS_LONG was removed in Python 3; the replacement is PyLong_AS_LONG, which is just a define for the function call PyLong_AsLong(op).

When I did the initial port to Python 3, these would have been logged as warnings (which of course pip hides), but they do mean that uses of the function (module?) that contain them would fail. I was using a different compiler here (ccache) that explicitly asked for those warnings to be errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions