Description of problem: When trying to address the bugzilla report that lhapdf is not buildable with Python 3.12, I encountered that Cython generates code that uses Python C API functions that have been removed in Python 3.12: /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp: In function ‘int __Pyx_PyUnicode_Equals(PyObject*, PyObject*, int)’: /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp:571:51: error: ‘_PyUnicode_Ready’ was not declared in this scope; did you mean ‘PyUnicode_READY’? 571 | 0 : _PyUnicode_Ready((PyObject *)(op))) | ^~~~~~~~~~~~~~~~ /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp:977:43: note: in definition of macro ‘unlikely’ 977 | #define unlikely(x) __builtin_expect(!!(x), 0) | ^ /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp:26280:22: note: in expansion of macro ‘__Pyx_PyUnicode_READY’ 26280 | if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) | ^~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp: In function ‘const char* __Pyx_PyUnicode_AsStringAndSize(PyObject*, Py_ssize_t*)’: /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp:571:51: error: ‘_PyUnicode_Ready’ was not declared in this scope; did you mean ‘PyUnicode_READY’? 571 | 0 : _PyUnicode_Ready((PyObject *)(op))) | ^~~~~~~~~~~~~~~~ /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp:977:43: note: in definition of macro ‘unlikely’ 977 | #define unlikely(x) __builtin_expect(!!(x), 0) | ^ /builddir/build/BUILD/LHAPDF-6.5.3/wrappers/python/lhapdf.cpp:29016:18: note: in expansion of macro ‘__Pyx_PyUnicode_READY’ 29016 | if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; | ^~~~~~~~~~~~~~~~~~~~~ Version-Release number of selected component (if applicable): DEBUG util.py:445: python3-Cython x86_64 0.29.32-1.fc38 \ python312 2.5 M How reproducible: Always Actual results: Generated code calls functions removed in Python 3.12 Expected results: Generated code compiles with Python 3.12 Additional info: Possibly fixed upstream by this commit: https://github.com/cython/cython/commit/b4595a04a78b79dc59276a9f64aab7b884e945e8
Thanks for the report and a possible fix. I'll have a look at this after the holidays.
https://src.fedoraproject.org/rpms/Cython/pull-request/39
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.