Build fails with Python 3.12 and clang 16 on macOS
The build of python-ligo-lw
fails when using Python 3.12.2 and clang 16.0.1:
$ sw_vers
ProductName: macOS
ProductVersion: 11.7.10
BuildVersion: 20G1427
$ git describe --tags
1.8.0-83-gcfaddad282
$ python3 --version
Python 3.12.2
$ clang --version
clang version 16.0.6
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Users/duncanmacleod/opt/mambaforge/envs/py312/bin
$ python3 setup.py build
/Users/duncanmacleod/opt/mambaforge/envs/py312/lib/python3.12/site-packages/setuptools/dist.py:700: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated.
!!
********************************************************************************
Please replace its usage with implicit namespaces (PEP 420).
See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages for details.
********************************************************************************
!!
ep.load()(self, ep.name, value)
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-312
creating build/lib.macosx-10.9-x86_64-cpython-312/ligo
creating build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/ligolw.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/lsctables.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/param.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/types.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/dbtables.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/table.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
copying ligo/lw/array.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw
creating build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/ligolw_add.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/search_summary.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/ilwd.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/segments.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/ligolw_sqlite.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/coincs.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/process.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
copying ligo/lw/utils/time_slide.py -> build/lib.macosx-10.9-x86_64-cpython-312/ligo/lw/utils
running build_ext
building 'ligo.lw.tokenizer' extension
creating build/temp.macosx-10.9-x86_64-cpython-312
creating build/temp.macosx-10.9-x86_64-cpython-312/ligo
creating build/temp.macosx-10.9-x86_64-cpython-312/ligo/lw
x86_64-apple-darwin13.4.0-clang -fno-strict-overflow -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /Users/duncanmacleod/opt/mambaforge/envs/py312/include -fPIC -O2 -isystem /Users/duncanmacleod/opt/mambaforge/envs/py312/include -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -isystem /Users/duncanmacleod/opt/mambaforge/envs/py312/include -D_FORTIFY_SOURCE=2 -isystem /Users/duncanmacleod/opt/mambaforge/envs/py312/include -Iligo/lw -I/Users/duncanmacleod/opt/mambaforge/envs/py312/include/python3.12 -c ligo/lw/tokenizer.RowBuilder.c -o build/temp.macosx-10.9-x86_64-cpython-312/ligo/lw/tokenizer.RowBuilder.o
ligo/lw/tokenizer.RowBuilder.c:231:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/duncanmacleod/opt/mambaforge/envs/py312/include/python3.12/object.h:141:11: note: expanded from macro 'PyObject_HEAD_INIT'
{ 1 }, \
^
ligo/lw/tokenizer.RowBuilder.c:231:2: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *' [-Wint-conversion]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/duncanmacleod/opt/mambaforge/envs/py312/include/python3.12/object.h:142:9: note: expanded from macro 'PyObject_HEAD_INIT'
(type) \
^~~~~~
1 warning and 1 error generated.
error: command '/Users/duncanmacleod/opt/mambaforge/envs/py312/bin/x86_64-apple-darwin13.4.0-clang' failed with exit code 1
I think the PyObject_HEAD_INIT(NULL)
needs to be modified to be PyVarObject_HEAD_INIT(NULL, 0)
.