Skip to content

feat(python): Add support for Python 3.14 free-threading#3259

Open
devansh0703 wants to merge 1 commit intogoogle-deepmind:mainfrom
devansh0703:free-threading-support
Open

feat(python): Add support for Python 3.14 free-threading#3259
devansh0703 wants to merge 1 commit intogoogle-deepmind:mainfrom
devansh0703:free-threading-support

Conversation

@devansh0703
Copy link
Copy Markdown

  • Detect free-threaded Python via Py_GIL_DISABLED sysconfig flag in CMake
  • Add mutex protection for global callback pointers in callbacks.cc
  • Add mutex protection for raw pointer hash maps in structs_wrappers.cc
  • Mutex guards only active in free-threaded mode (zero overhead with GIL Python)
  • pybind11 v3.0.4 handles atomic refcounting and module init automatically

Fixes #3256

- Detect free-threaded Python via Py_GIL_DISABLED sysconfig flag in CMake
- Add mutex protection for global callback pointers in callbacks.cc
- Add mutex protection for raw pointer hash maps in structs_wrappers.cc
- Mutex guards only active in free-threaded mode (zero overhead with GIL Python)
- pybind11 v3.0.4 handles atomic refcounting and module init automatically

Fixes google-deepmind#3256
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@devansh0703 devansh0703 closed this May 6, 2026
@devansh0703 devansh0703 reopened this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Support Python 3.14 free-threading

1 participant