Bug 2172822

Summary: Cython fails to build with Python 3.12: error: PyLongObject {aka struct _longobject} has no member named ob_digit
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: CythonAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: igor.raits, mhroncok, ndbecker2, python-packagers-sig, steve.traylen, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Cython-0.29.34-1.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-08 23:05:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1823181    
Bug Blocks: 2155429    

Description Tomáš Hrnčiar 2023-02-23 08:24:21 UTC
Cython fails to build with Python 3.12.0a5.

/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:2985:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
 2985 |     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.12/dictobject.h:90,
                 from /usr/include/python3.12/Python.h:61,
                 from /builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:21:
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_get_tp_dict_version’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:8339:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
 8339 |     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
      |     ^~~~~~
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_get_object_dict_version’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:8351:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
 8351 |     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
      |     ^~~~~~
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_object_dict_version_matches’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:8355:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
 8355 |     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
      |     ^~
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx__GetModuleGlobalName’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:8705:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
 8705 |     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
      |     ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_CLineForTraceback’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:10207:9: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
10207 |         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:10207:9: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
10207 |         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.12/cpython/dictobject.h:22:34: note: declared here
   22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
      |                                  ^~~~~~~~~~~~~~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_PyInt_As_long’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:10651:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
10651 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
      |                                                     ^~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:10706:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
10706 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
      |                                                     ^~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_PyInt_As_int’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:10847:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
10847 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
      |                                                     ^~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:10902:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
10902 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
      |                                                     ^~
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c: In function ‘__Pyx_PyIndex_AsSsize_t’:
/builddir/build/BUILD/cython-0.29.33/Cython/Plex/Scanners.c:11353:45: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
11353 |     const digit* digits = ((PyLongObject*)b)->ob_digit;
      |                                             ^~

https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05538359-Cython/

For all our attempts to build Cython with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/Cython/
Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Tomáš Hrnčiar 2023-02-23 08:40:21 UTC
This problem is already fixed in Cython's 3.0.0 master branch. But upstream hasn't backported it to 0.29.x branch yet. 

https://github.com/cython/cython/issues/5238#issuecomment-1431349376

I wonder if it's worth patching 0.29.x or if it's better to spend the resources on packaging Cython 3.0.0 into Fedora and testing its impact as we discussed wrt bug 1823181. The question is how dangerous it would be to use Cython 3.0.0 for Python 3.12 mass rebuild. 

@mhroncok WDYT?

Comment 2 Miro Hrončok 2023-02-23 10:32:19 UTC
Feel free to temporarily use Cython 3 in the Python 3.12 copr, as copr is a playground where we can easily revert such things.

For a real Fedora update, I'd rather not intermingle the Cython 3 effort with the Python 3.12 effort in case one of them turns out to block the other. If a backport is at all possible, we should attempt it.

Comment 4 Fedora Update System 2023-04-08 23:04:11 UTC
FEDORA-2023-d14b68654f has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-d14b68654f

Comment 5 Fedora Update System 2023-04-08 23:05:55 UTC
FEDORA-2023-d14b68654f has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.