python-gmpy2 fails to build with Python 3.12.0a7. In file included from src/gmpy2.c:605: src/gmpy2_convert_gmp.c: In function ‘GMPy_MPZ_From_PyIntOrLong’: src/gmpy2_convert_gmp.c:64:48: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 64 | mpz_set_si(result->z, -(sdigit)templong->ob_digit[0]); | ^~ src/gmpy2_convert_gmp.c:70:39: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 70 | mpz_set_si(result->z, templong->ob_digit[0]); | ^~ src/gmpy2_convert_gmp.c:83:55: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 83 | mpz_import(result->z, len, -1, sizeof(templong->ob_digit[0]), 0, | ^~ src/gmpy2_convert_gmp.c:84:35: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 84 | sizeof(templong->ob_digit[0])*8 - PyLong_SHIFT, templong->ob_digit); | ^~ src/gmpy2_convert_gmp.c:84:76: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 84 | sizeof(templong->ob_digit[0])*8 - PyLong_SHIFT, templong->ob_digit); | ^~ src/gmpy2_convert_gmp.c: In function ‘mpz_set_PyIntOrLong’: src/gmpy2_convert_gmp.c:110:40: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 110 | mpz_set_si(z, -(sdigit)templong->ob_digit[0]); | ^~ src/gmpy2_convert_gmp.c:116:31: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 116 | mpz_set_si(z, templong->ob_digit[0]); | ^~ src/gmpy2_convert_gmp.c:129:47: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 129 | mpz_import(z, len, -1, sizeof(templong->ob_digit[0]), 0, | ^~ src/gmpy2_convert_gmp.c:130:35: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 130 | sizeof(templong->ob_digit[0])*8 - PyLong_SHIFT, templong->ob_digit); | ^~ src/gmpy2_convert_gmp.c:130:76: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 130 | sizeof(templong->ob_digit[0])*8 - PyLong_SHIFT, templong->ob_digit); | ^~ src/gmpy2_convert_gmp.c: In function ‘GMPy_PyLong_From_MPZ’: src/gmpy2_convert_gmp.c:203:22: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 203 | mpz_export(result->ob_digit, &count, -1, sizeof(result->ob_digit[0]), 0, | ^~ src/gmpy2_convert_gmp.c:203:59: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 203 | mpz_export(result->ob_digit, &count, -1, sizeof(result->ob_digit[0]), 0, | ^~ src/gmpy2_convert_gmp.c:204:29: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 204 | sizeof(result->ob_digit[0])*8 - PyLong_SHIFT, obj->z); | ^~ src/gmpy2_convert_gmp.c:207:15: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 207 | result->ob_digit[0] = 0; | ^~ src/gmpy2_convert_gmp.c:212:31: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 212 | while ((size>0) && (result->ob_digit[size-1] == 0)) { | ^~ src/gmpy2_convert_gmp.c: In function ‘GMPy_XMPZ_From_PyIntOrLong’: src/gmpy2_convert_gmp.c:481:48: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 481 | mpz_set_si(result->z, -(sdigit)templong->ob_digit[0]); | ^~ src/gmpy2_convert_gmp.c:487:39: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 487 | mpz_set_si(result->z, templong->ob_digit[0]); | ^~ src/gmpy2_convert_gmp.c:500:55: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 500 | mpz_import(result->z, len, -1, sizeof(templong->ob_digit[0]), 0, | ^~ src/gmpy2_convert_gmp.c:501:35: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 501 | sizeof(templong->ob_digit[0])*8 - PyLong_SHIFT, templong->ob_digit); | ^~ src/gmpy2_convert_gmp.c:501:76: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’ 501 | sizeof(templong->ob_digit[0])*8 - PyLong_SHIFT, templong->ob_digit); | ^~ error: command '/usr/bin/gcc' failed with exit code 1 error: subprocess-exited-with-error × Building wheel for gmpy2 (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /usr/bin/python3 /usr/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /builddir/build/BUILD/gmpy2-2.1.5/.pyproject-builddir/tmpvjvxwo4h cwd: /builddir/build/BUILD/gmpy2-2.1.5 Building wheel for gmpy2 (pyproject.toml): finished with status 'error' ERROR: Failed building wheel for gmpy2 PyLongObject was refactored in 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/05839604-python-gmpy2/ For all our attempts to build python-gmpy2 with Python 3.12, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-gmpy2/ 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.
I backported an upstream change to fix this and built into the python 3.12 side tag.