gh-146636: Add Free-threaded Stable ABI migration guide#148453
gh-146636: Add Free-threaded Stable ABI migration guide#148453clin1234 wants to merge 10 commits intopython:mainfrom
Conversation
This document provides detailed instructions on how to use the Free Threading Stable ABI in CPython, including guidelines for module initialization, API usage, and thread safety considerations.
Clarified access restrictions on PyObject members and recommended functions for type and reference count manipulation.
Clarified that direct access to PyObject members is prohibited.
da-woods
left a comment
There was a problem hiding this comment.
There's a lot that isn't right here (or is mostly about freethreading generally rather than about the stable ABI).
| :c:func:`PyDict_SetItem`, or explicitly using macros), it attempts to acquire | ||
| the underlying mutex. | ||
|
|
||
| Using Critical Sections |
There was a problem hiding this comment.
The weakness right now is that I don't think they're part of the stable ABI (but hopefully will be)
There was a problem hiding this comment.
If you were referring to https://docs.python.org/3/c-api/dict.html#c.PyDict_SetItem, it's part of the Stable ABI: https://docs.python.org/3/c-api/dict.html#c.PyDict_SetItem
There was a problem hiding this comment.
No - I was referring to critical sections. Which I really hope are added before 3.15 comes out but I don't think currently are. Sorry if that was ambiguous.
|
I think the way most people will want to proceed is:
But steps 1 and 2 are the main ones and are almost not covered here. |
|
Based on WIP PR: #148013 |
|
I don't understand why we are having this PR when the reference documentation is not merged. Can we revisit this later? I would have expected the PEP's author to write this. |
Updated documentation to clarify the identification of free-threaded limited API builds in C, including changes to macros and initialization methods.
Updated the documentation to clarify the use of the stable ABI and GIL management in Python extensions, including changes to member access and initialization methods.
📚 Documentation preview 📚: https://cpython-previews--148453.org.readthedocs.build/