-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Description
This issue is intended to track the efforts of adding support for the free-threaded build for CPython (3.14t and potentially 3.13t). The Python free-threading guide contains some helpful advice on approaching this task. Based on what has been done for pybind11, I think the following steps make sense:
- Add mechanism to set the
Py_MOD_GIL_NOT_USED. I have a patch that does something similar to what pybind11 does: add a variadic macro with an optional flag so extensions can opt-in to free-threaded support - Replace borrow based APIs with strong reference ones (e.g.
PyDict_GetItemRef) - Use a mutex to protect global state (e.g. the registry)
- Fix references to
ob_refcnt, don't usePy_REFCNT()as an l-value. - Modify tests so we can run them in parallel, run with the TSAN build to find races
- Fixes to "faber" to work with new versions of Python. The most recent release of faber fixes most things, I believe.
I have code that does most of this, I will create a PR. I'm still working on some crash bugs when running with 3.14t. If you run the Boost.Python tests with a single thread, they pass. So that's encouraging.
Related issues:
Related PRs:
CEXT-Dan
Metadata
Metadata
Assignees
Labels
No labels