Functions requested by @wjakob who works on nanobind. Copy/paste of PR python/cpython#148324 description.
This PR promotes PyObject_GetItemData() and PyObject_GetItemData_DuringGC() to the stable ABI (analogous to PyObject_GetTypeData() and PyObject_GetTypeData_DuringGC() that are already in the stable ABI).
The function PyObject_GetItemData() is needed to access the entries of variable sized objects (PyVarObject).
Why this change?
PyVarObject becomes opaque in abi3t.
- nanobind (used by large-scale ML and compiler projects like Google's JAX, Apple's MLX, LLVM, MLIR, ...) uses a variable sized function object
- Ergo: without access to
PyObject_GetItemData(), nanobind cannot run on abi3t.
The function was added by PEP 697 "Limited C API for Extending Opaque Types" to Python 3.12. The function is documented and tested (by test_capi.test_misc). IMO it makes sense to add it to the stable ABI. Without this function, it's not possible to access data of PyVarObject objects in the stable ABI.
Vote:
Functions requested by @wjakob who works on nanobind. Copy/paste of PR python/cpython#148324 description.
This PR promotes
PyObject_GetItemData()andPyObject_GetItemData_DuringGC()to the stable ABI (analogous toPyObject_GetTypeData()andPyObject_GetTypeData_DuringGC()that are already in the stable ABI).The function
PyObject_GetItemData()is needed to access the entries of variable sized objects (PyVarObject).Why this change?
PyVarObjectbecomes opaque inabi3t.PyObject_GetItemData(), nanobind cannot run onabi3t.The function was added by PEP 697 "Limited C API for Extending Opaque Types" to Python 3.12. The function is documented and tested (by
test_capi.test_misc). IMO it makes sense to add it to the stable ABI. Without this function, it's not possible to access data ofPyVarObjectobjects in the stable ABI.Vote: