Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12: error: PyLongObject {aka struct _longobject} has no member named ob_digit #2720

Closed
vkrizan opened this issue May 3, 2023 · 4 comments

Comments

@vkrizan
Copy link
Contributor

vkrizan commented May 3, 2023

Peewee 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
python/cpython#101292
https://docs.python.org/3.12/whatsnew/3.12.html

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2192872

Thank you!

@coleifer
Copy link
Owner

coleifer commented May 3, 2023

3.12 is still 6 months away from being released!

That said thank you for the report. This is actually an issue with Cython. Cython optimizes access to certain CPython internals, so when an internal refactor like this occurs, Cython has to implement a complementary change.

Discussion and fix here: cython/cython#5238

This is fixed in master for Cython and looks to be targeting the 3.0 milestone.

Installing Cython 3.0.0b1 should resolve the problem for you on 3.12a5 and up.

@coleifer coleifer closed this as completed May 3, 2023
@vkrizan
Copy link
Contributor Author

vkrizan commented May 3, 2023

Folks on Fedora project have rebuilt the Cython generated code and it passed the build.

@hroncok
Copy link

hroncok commented May 3, 2023

Note that this is fixed in Cython 0.29.34, so regenerating the C sources with it should make it easier for folks who want to test peewee with Python 3.12 pre-releases before it is released (which is what we currently do in Fedora).

@coleifer
Copy link
Owner

coleifer commented May 3, 2023

The C sources aren't version-controlled but I typically include them when I release, so the next release will contain updated ones. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants