Bug 2192872

Summary: python-peewee 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: python-peeweeAssignee: Viliam Križan <vkrizan>
Status: MODIFIED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: carl, jonathan, mhroncok, python-packagers-sig, thrnciar, vkrizan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:    
Bug Blocks: 2135404    

Description Tomáš Hrnčiar 2023-05-03 11:20:29 UTC
python-peevee fails to build with Python 3.12.0a7.

  playhouse/_sqlite_udf.c: In function ‘__Pyx_PyInt_AddObjC’:
  playhouse/_sqlite_udf.c:5604:51: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   5604 |         const digit* digits = ((PyLongObject*)op1)->ob_digit;
        |                                                   ^~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_PyUnicode_Equals’:
  playhouse/_sqlite_udf.c:569:51: warning: implicit declaration of function ‘_PyUnicode_Ready’; did you mean ‘PyUnicode_READY’? [-Wimplicit-function-declaration]
    569 |                                               0 : _PyUnicode_Ready((PyObject *)(op)))
        |                                                   ^~~~~~~~~~~~~~~~
  playhouse/_sqlite_udf.c:944:43: note: in definition of macro ‘unlikely’
    944 |   #define unlikely(x) __builtin_expect(!!(x), 0)
        |                                           ^
  playhouse/_sqlite_udf.c:6097:22: note: in expansion of macro ‘__Pyx_PyUnicode_READY’
   6097 |         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
        |                      ^~~~~~~~~~~~~~~~~~~~~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_Raise’:
  playhouse/_sqlite_udf.c:6584:34: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘curexc_traceback’
   6584 |         PyObject* tmp_tb = tstate->curexc_traceback;
        |                                  ^~
  playhouse/_sqlite_udf.c:6587:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘curexc_traceback’
   6587 |             tstate->curexc_traceback = tb;
        |                   ^~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_PyInt_EqObjC’:
  playhouse/_sqlite_udf.c:6827:51: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   6827 |         const digit* digits = ((PyLongObject*)op1)->ob_digit;
        |                                                   ^~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_CLineForTraceback’:
  playhouse/_sqlite_udf.c:6892:9: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
   6892 |         __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;
        |                                  ^~~~~~~~~~~~~~
  playhouse/_sqlite_udf.c:6892:9: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
   6892 |         __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;
        |                                  ^~~~~~~~~~~~~~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_PyInt_As_int’:
  playhouse/_sqlite_udf.c:7193:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   7193 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
        |                                                     ^~
  playhouse/_sqlite_udf.c:7248:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   7248 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
        |                                                     ^~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_PyInt_As_long’:
  playhouse/_sqlite_udf.c:7427:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   7427 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
        |                                                     ^~
  playhouse/_sqlite_udf.c:7482:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   7482 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
        |                                                     ^~
  playhouse/_sqlite_udf.c: In function ‘__Pyx_PyIndex_AsSsize_t’:
  playhouse/_sqlite_udf.c:7933:45: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
   7933 |     const digit* digits = ((PyLongObject*)b)->ob_digit;
        |                                             ^~

GH-101291: Refactor the PyLongObject struct #101292
https://github.com/python/cpython/pull/101292
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/5840249-python-peevee/

For all our attempts to build python-peevee with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-peevee/

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 Viliam Križan 2023-05-03 11:24:28 UTC
Reported upstream: https://github.com/coleifer/peewee/issues/2720

Comment 2 Miro Hrončok 2023-05-03 11:58:49 UTC
__Pyx_PyInt_As_int makes me think this is Cython-generated code.

All Cython-generated code must be removed in %prep and regenerated during build: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_using_cython


[python-peewee (rawhide)]$ fedpkg --release rawhide prep
...
[python-peewee (rawhide %)]$ rg 'Generated by Cython' peewee-3.16.0
peewee-3.16.0/playhouse/_sqlite_udf.c
1:/* Generated by Cython 0.29.32 */

peewee-3.16.0/playhouse/_sqlite_ext.c
1:/* Generated by Cython 0.29.32 */

Comment 3 Tomáš Hrnčiar 2023-05-03 12:08:34 UTC
Yup, removing Cython-generated code helped and the build passed.

Comment 4 Tomáš Hrnčiar 2023-05-03 12:19:45 UTC
PR: https://src.fedoraproject.org/rpms/python-peewee/pull-request/5

Comment 5 Viliam Križan 2023-05-03 12:50:10 UTC
Merged.

Should I close the upstream issue?

Comment 6 Tomáš Hrnčiar 2023-05-03 12:51:46 UTC
Thank you, upstream has already closed it.

Comment 7 Fedora Release Engineering 2023-08-16 07:13:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.