Bug 2155702 - Cython generates code that uses Python C API functions removed in Python 3.12
Summary: Cython generates code that uses Python C API functions removed in Python 3.12
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Cython
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomáš Hrnčiar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12 2154877 2155427
TreeView+ depends on / blocked
 
Reported: 2022-12-21 23:04 UTC by Mattias Ellert
Modified: 2023-02-23 08:29 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-02-23 08:29:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mattias Ellert 2022-12-21 23:04:49 UTC
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

Comment 1 Miro Hrončok 2022-12-22 01:20:46 UTC
Thanks for the report and a possible fix. I'll have a look at this after the holidays.

Comment 3 Ben Cotton 2023-02-07 15:13:16 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.


Note You need to log in before you can comment on or make changes to this bug.