Bug 2245652

Summary: python-drgn fails to build with Python 3.13: error: implicit declaration of function ‘_Py_IDENTIFIER‘, '_PyLong_AsByteArray', '_PyLong_FromByteArray', '_PyObject_GetAttrId'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-drgnAssignee: Omar Sandoval <osandov>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: davide, filbranden, ksurma, mhroncok, michel, osandov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-drgn-0.0.26-1.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-03-12 13:23:43 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:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-23 13:12:07 UTC
python-drgn fails to build with Python 3.13.0a1.

../../libdrgn/python/object.c: In function 'py_long_to_bytes_for_object_type':
../../libdrgn/python/object.c:74:17: error: implicit declaration of function '_PyLong_AsByteArray' [-Werror=implicit-function-declaration]
   74 |         int r = _PyLong_AsByteArray((PyLongObject *)long_obj, buf, size,
      |                 ^~~~~~~~~~~~~~~~~~~
libtool: compile:  gcc -DPACKAGE_NAME=\"libdrgn\" -DPACKAGE_TARNAME=\"libdrgn\" -DPACKAGE_VERSION=\"0.0.24\" "-DPACKAGE_STRING=\"libdrgn 0.0.24\"" -DPACKAGE_BUGREPORT=\"https://github.com/osandov/drgn/issues\" -DPACKAGE_URL=\"https://github.com/osandov/drgn\" -DPACKAGE=\"libdrgn\" -DVERSION=\"0.0.24\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -Dauto=__auto_type -DWITH_LIBKDUMPFILE=1 -I. -I../../libdrgn -I ../../libdrgn/include -D_GNU_SOURCE -I/usr/include/python3.13 -iquote ../../libdrgn/python -iquote python -fvisibility=hidden -I/usr/include/lzo -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MT python/_drgn_la-program.lo -MD -MP -MF python/.deps/_drgn_la-program.Tpo -c ../../libdrgn/python/program.c  -fPIC -DPIC -o python/.libs/_drgn_la-program.o
../../libdrgn/python/object.c: In function 'DrgnObject_value_impl':
../../libdrgn/python/object.c:698:24: error: implicit declaration of function '_PyLong_FromByteArray' [-Werror=implicit-function-declaration]
  698 |                 return _PyLong_FromByteArray((void *)value->bufp,
      |                        ^~~~~~~~~~~~~~~~~~~~~
../../libdrgn/python/object.c:698:24: warning: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
  698 |                 return _PyLong_FromByteArray((void *)value->bufp,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  699 |                                              drgn_object_size(obj),
      |                                              ~~~~~~~~~~~~~~~~~~~~~~
  700 |                                              obj->little_endian,
      |                                              ~~~~~~~~~~~~~~~~~~~
  701 |                                              obj->encoding
      |                                              ~~~~~~~~~~~~~
  702 |                                              == DRGN_OBJECT_ENCODING_SIGNED_BIG);
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../libdrgn/python/object.c: In function 'DrgnObject_dir':
../../libdrgn/python/object.c:1539:9: error: implicit declaration of function '_Py_IDENTIFIER' [-Werror=implicit-function-declaration]
 1539 |         _Py_IDENTIFIER(__dir__);
      |         ^~~~~~~~~~~~~~
../../libdrgn/python/object.c:1539:24: error: '__dir__' undeclared (first use in this function)
 1539 |         _Py_IDENTIFIER(__dir__);
      |                        ^~~~~~~
../../libdrgn/python/object.c:1539:24: note: each undeclared identifier is reported only once for each function it appears in
../../libdrgn/python/object.c:1541:17: error: implicit declaration of function '_PyObject_GetAttrId'; did you mean 'PyObject_GetAttr'? [-Werror=implicit-function-declaration]
 1541 |                 _PyObject_GetAttrId((PyObject *)Py_TYPE(self)->tp_base,
      |                 ^~~~~~~~~~~~~~~~~~~
      |                 PyObject_GetAttr
../../libdrgn/python/object.c:1542:38: error: 'PyId___dir__' undeclared (first use in this function)
 1542 |                                     &PyId___dir__);
      |                                      ^~~~~~~~~~~~

Some private C API functions, including _Py_IDENTIFIER,
 have been removed from Python 3.13.
The detailed list of the removed private C API functions can be found here:
https://github.com/python/cpython/issues/106320


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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06551029-python-drgn/

For all our attempts to build python-drgn with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-drgn/

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.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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 Davide Cavalca 2023-10-23 17:03:51 UTC
This is being worked on upstream

Comment 2 Omar Sandoval 2023-10-23 20:20:31 UTC
Upstream tracking issue: https://github.com/osandov/drgn/issues/361

Comment 3 Aoife Moloney 2024-02-15 23:00:30 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.