You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--disable-gil builds are not compatible with the limited API #111506
After #110764, --disable-gil builds of CPython 3.13 are (temporarily) not be compatible with the limited API or the stable ABI due to modifications to the PyObject header. For context, this was noted in the "Backwards Compatibility" section of PEP 703.
Based on feedback on the related discuss post and discussions with Gregory Smith, Guido, Petr, and Victor at the core dev sprint, I believe we can make changes to the stable ABI so that extension author can target a single stable ABI that supports CPython 3.7+ and both the default build and the --disable-gil builds of CPython 3.13+.
These changes will require a PEP. This issue is intended just to keep track of the known problem.
The rough idea is:
make a number of macro/inline functions (e.g., Py_SIZE, Py_TYPE, Py_SET_REFCNT, Py_REFCNT) "real" function calls in the stable ABI for CPython 3.13+
When targeting CPython <= 3.12, use dynamic symbol lookup (GetProcAddress on Windows) or weak symbols (on Linux/macOS) to determine at runtime if the active CPython version provides the desired functions. Otherwise, fall back to old definitions of the above functions for CPython <= 3.12.
Before creating a whole new ABI, I would like first to avoid __asm__(...); in Include/*.h, in the limited C API. Assembly code is not portable and can cause compilation issues.
A first step for that is to implement Py_SET_REFCNT() as a function call: PR #111508.
Activity
corona10 commentedon Oct 30, 2023
cc @vstinner
pythongh-111506: Implement Py_SET_REFCNT() as opaque function in limi…
pythongh-111506: Implement Py_SET_REFCNT() as opaque function in limi…
vstinner commentedon Oct 30, 2023
Before creating a whole new ABI, I would like first to avoid
__asm__(...);inInclude/*.h, in the limited C API. Assembly code is not portable and can cause compilation issues.A first step for that is to implement Py_SET_REFCNT() as a function call: PR #111508.
pythongh-111506: Implement Py_SET_REFCNT() as opaque function in limi…
encukou commentedon Oct 31, 2023
These changes will require a PEP.
Please, could we have the PEP first, then do the changes?
gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C …
pythongh-111506: Implement Py_REFCNT() as opaque function call
pythongh-111506: Implement Py_REFCNT() as opaque function call
encukou commentedon Dec 5, 2023
@colesbury, do you still plan to write the PEP? Do you need any help?
colesbury commentedon Dec 5, 2023
@encukou, yes I still intend to write the PEP. It just hasn't been as a high a priority as integrating the pieces of PEP 703.
34 remaining items
Update setuptools requirement from ~=72.2.0 to ~=73.0.0 (#36)
Support Py_GIL_DISABLED
Support Py_GIL_DISABLED
Support Py_GIL_DISABLED
Support Py_GIL_DISABLED
Support Py_GIL_DISABLED
Support Py_GIL_DISABLED
Support Py_GIL_DISABLED (#206)
Fix free-threaded Python builds
wheel: Don't enable limited API when using a no-gil build
kumaraditya303 commentedon Apr 5, 2026
Closing this in favor of #146636 which implements abi3t
py-setuptools: update to 73.0.1.
py-setuptools: update to 73.0.1.
ci: pin pyvista<0.49, it cannot install on free-threaded python