python-ligo-lw incompatible with python 3.10: PyLong_FromUnicode has been removed
python-ligo-lw cannot be used with Python 3.10 as follows:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ git rev-parse HEAD
40a1c07d8db89c094d71db35aa378ba222c89412
$ python3 --version
Python 3.10.0
$ CFLAGS="${CFLAGS} -Wfatal-errors -Werror=implicit-function-declaration" python3 setup.py build_ext --inplace
/home/duncan/git/python-ligo-lw/setup.py:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.core import setup, Extension
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'namespace_packages'
warnings.warn(msg)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/distutils/command/build_ext.py:13: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
from distutils.sysconfig import customize_compiler, get_python_version
running build_ext
building 'ligo.lw.tokenizer' extension
gcc -pthread -B /home/duncan/opt/mambaforge/envs/py310/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/duncan/opt/mambaforge/envs/py310/include -fPIC -O2 -isystem /home/duncan/opt/mambaforge/envs/py310/include -Wfatal-errors -Werror=implicit-function-declaration -fPIC -Iligo/lw -I/home/duncan/opt/mambaforge/envs/py310/include/python3.10 -c ligo/lw/tokenizer.RowBuilder.c -o build/temp.linux-x86_64-3.10/ligo/lw/tokenizer.RowBuilder.o
ligo/lw/tokenizer.RowBuilder.c:230:39: warning: missing braces around initializer [-Wmissing-braces]
PyTypeObject ligolw_RowBuilder_Type = {
^
ligo/lw/tokenizer.RowBuilder.c:230:39: warning: missing braces around initializer [-Wmissing-braces]
gcc -pthread -B /home/duncan/opt/mambaforge/envs/py310/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/duncan/opt/mambaforge/envs/py310/include -fPIC -O2 -isystem /home/duncan/opt/mambaforge/envs/py310/include -Wfatal-errors -Werror=implicit-function-declaration -fPIC -Iligo/lw -I/home/duncan/opt/mambaforge/envs/py310/include/python3.10 -c ligo/lw/tokenizer.RowDumper.c -o build/temp.linux-x86_64-3.10/ligo/lw/tokenizer.RowDumper.o
ligo/lw/tokenizer.RowDumper.c: In function ‘__init__’:
ligo/lw/tokenizer.RowDumper.c:103:3: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
rowdumper->delimiter = PyUnicode_FromUnicode(&default_delimiter, 1);
^~~~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.RowDumper.c:29:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:551:42: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.RowDumper.c: In function ‘next’:
ligo/lw/tokenizer.RowDumper.c:223:4: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
token = PyUnicode_FromUnicode(NULL, 0); /* u"" */
^~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.RowDumper.c:29:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:551:42: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.RowDumper.c: At top level:
ligo/lw/tokenizer.RowDumper.c:280:38: warning: missing braces around initializer [-Wmissing-braces]
PyTypeObject ligolw_RowDumper_Type = {
^
ligo/lw/tokenizer.RowDumper.c:280:38: warning: missing braces around initializer [-Wmissing-braces]
gcc -pthread -B /home/duncan/opt/mambaforge/envs/py310/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/duncan/opt/mambaforge/envs/py310/include -fPIC -O2 -isystem /home/duncan/opt/mambaforge/envs/py310/include -Wfatal-errors -Werror=implicit-function-declaration -fPIC -Iligo/lw -I/home/duncan/opt/mambaforge/envs/py310/include/python3.10 -c ligo/lw/tokenizer.Tokenizer.c -o build/temp.linux-x86_64-3.10/ligo/lw/tokenizer.Tokenizer.o
ligo/lw/tokenizer.Tokenizer.c: In function ‘add_to_data’:
ligo/lw/tokenizer.Tokenizer.c:96:2: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
Py_ssize_t n = PyUnicode_GET_SIZE(unicode);
^~~~~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:96:2: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
Py_ssize_t n = PyUnicode_GET_SIZE(unicode);
^~~~~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:96:2: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
Py_ssize_t n = PyUnicode_GET_SIZE(unicode);
^~~~~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:138:3: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
memcpy(tokenizer->length, PyUnicode_AsUnicode(unicode), n * sizeof(*tokenizer->length));
^~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c: In function ‘parse_error’:
ligo/lw/tokenizer.Tokenizer.c:200:2: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
buffer_str = PyUnicode_FromUnicode(buffer, buffer_length);
^~~~~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:551:42: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:201:2: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
pos_str = PyUnicode_FromUnicode(pos, 1);
^~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:551:42: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c: In function ‘__init__’:
ligo/lw/tokenizer.Tokenizer.c:514:2: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
if(PyUnicode_GET_SIZE(arg) != 1) {
^~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:514:2: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
if(PyUnicode_GET_SIZE(arg) != 1) {
^~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:514:2: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
if(PyUnicode_GET_SIZE(arg) != 1) {
^~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:519:2: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
tokenizer->delimiter = *PyUnicode_AS_UNICODE(arg);
^~~~~~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c: In function ‘next’:
ligo/lw/tokenizer.Tokenizer.c:584:3: warning: ‘PyUnicode_EncodeDecimal’ is deprecated [-Wdeprecated-declarations]
if(PyUnicode_EncodeDecimal(start, end - start, ascii_buffer, NULL))
^~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:952:36: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
^~~~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:598:3: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
token = PyUnicode_FromUnicode(start, end - start);
^~~~~
In file included from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/unicodeobject.h:1046,
from /home/duncan/opt/mambaforge/envs/py310/include/python3.10/Python.h:96,
from ligo/lw/tokenizer.Tokenizer.c:32:
/home/duncan/opt/mambaforge/envs/py310/include/python3.10/cpython/unicodeobject.h:551:42: note: declared here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^~~~~~~~~~~~~~~~~~~~~
ligo/lw/tokenizer.Tokenizer.c:607:11: error: implicit declaration of function ‘PyLong_FromUnicode’; did you mean ‘PyLong_FromPid’? [-Werror=implicit-function-declaration]
token = PyLong_FromUnicode(start, end - start, 0);
^~~~~~~~~~~~~~~~~~
PyLong_FromPid
compilation terminated due to -Wfatal-errors.
cc1: some warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1
For details of the Python 3.10 change, see here. @kipp.cannon, are you able to provide a patch for this?