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
Support for free-threaded CPython (3.14t or newer) #503
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 use Py_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.
Activity
rgommers commentedon Feb 9, 2026
@nascheme this can be closed right, after your work from gh-504 was merged?
nascheme commentedon Feb 9, 2026
Yes, I'll close.