py-pgproto icon indicating copy to clipboard operation
py-pgproto copied to clipboard

Unable to build on Python 3.12

Open robd003 opened this issue 2 years ago • 1 comments

Getting a lot of these errors when trying to build https://github.com/MagicStack/asyncpg on Python 3.12:

  asyncpg/pgproto/pgproto.c:40800:55: error: no member named 'ob_digit' in 'struct _longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^
  asyncpg/pgproto/pgproto.c:40855:55: error: no member named 'ob_digit' in 'struct _longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^
  asyncpg/pgproto/pgproto.c:41034:55: error: no member named 'ob_digit' in 'struct _longobject'
              const digit* digits = ((PyLongObject*)x)->ob_digit;
                                    ~~~~~~~~~~~~~~~~~~  ^

I believe this can be solved by converting ((PyLongObject*)x)->ob_digit to ((PyLongObject*)x)->long_value->ob_digit

robd003 avatar Oct 14 '23 18:10 robd003

Checking to see if cython 3.0.4 fixes this...

Upgrading cython to >=3.0.0 fixes this and no more compilation errors.

robd003 avatar Oct 14 '23 19:10 robd003