Open
Description
This issue is for tracking progress for the builtin wrappers to support the Python Stable ABI by defined Py_LIMITED_API
.
It follows on from earlier work, importantly since the addition of heap types in #3196 which also concludes that the minimum Python that can be supported is 3.9. So the goal is to generate wrappers for the Python Stable ABI for python-3.9 and later.
A quick summary of identified issues are in the table below which result from compiling the class C++ class example as follows using python-3.14 and setting PY_ABI_VER=3.14
which in turns invokes g++ with -DPy_LIMITED_API=0x030E0000
:
cd Examples/python/class
env SWIG_FEATURES=-builtin make clean check CXXFLAGS=-DSWIG_HEAPTYPES PY_ABI_VER=3.14
Num | Error message | Example code |
---|---|---|
1 | error: invalid use of incomplete type ‘PyTypeObject’ {aka ‘struct _typeobject’} | Py_TYPE(name)->tp_name) |
PyDict_Merge(pytype->tp_dict, dict, 1) | ||
Py_TYPE(descr)->tp_descr_set | ||
if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) | ||
2 | error: ‘_PyType_Lookup’ was not declared in this scope | descr = _PyType_Lookup(tp, name) |
3 | error: ‘PyDescrObject’ was not declared in this scope | #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) |
4 | error: ‘PyGetSetDescrObject’ was not declared in this scope | PyGetSetDescrObject *descr ... if (descr->d_getset->set != NULL) |
5 | error: ‘PyDescr_TYPE’ was not declared in this scope | Py_VISIT((PyObject*) PyDescr_TYPE(descr)) |