wjakob · GitHub

Bug report

Bug description:

To my knowledge, one can use newer Python version (e.g. Python 3.13) to build C extensions for older Python versions (e.g. 3.12) when targeting the stable ABI. This is accomplished by setting Py_LIMITED_API to a suitable number like 0x030b0000, which simply disables all features beyond this cutoff.

If this understanding is correct, then I would like to report a bug:

Python 3.13 added an new C API function for PyObject_DelAttr(). In contrast, Python 3.12 realized this operation using a macro wrapping PyObject_SetAttr():

#define  PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)

This change is problematic: extensions built on 3.13 targeting 3.12 stable ABI will now call a function that does not exist on Python 3.12, and such extensions will fail to load with a linker error. The change to the new C API entry point should have been guarded with #ifdefs.

This issue also affects PyObject_DelAttrString().

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Read the original on github.com ↗