pybind11/tests/test_embed
Sam Gross baa540ec34
fix: support free-threaded CPython with GIL disabled (#5148)
* Support free-threaded CPython (PEP 703)

Some additional locking is added in the free-threaded build when
`Py_GIL_DISABLED` is defined:

- Most accesses to internals are protected by a single mutex
- The registered_instances uses a striped lock to improve concurrency

Pybind11 modules can indicate support for running with the GIL disabled
by calling `set_gil_not_used()`.

* refactor: use PYBIND11_MODULE (#11)

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Address code review

* Suppress MSVC warning

* Changes from review

* style: pre-commit fixes

* `py::mod_gil_not_used()` suggestion.

* Update include/pybind11/pybind11.h

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2024-06-18 13:54:38 -07:00
..
catch.cpp Introduce a new style of warning suppression based on push/pop (#4285) 2022-11-28 07:39:38 -08:00
CMakeLists.txt fix: Python 3.13t with GIL (#5139) 2024-05-28 09:07:59 -04:00
external_module.cpp fix: support free-threaded CPython with GIL disabled (#5148) 2024-06-18 13:54:38 -07:00
test_interpreter.cpp Introduce get_python_state_dict() for Python 3.12 compatibility. (#4570) 2023-03-27 17:52:57 -07:00
test_interpreter.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_trampoline.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00