mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-21 14:23:14 +08:00
* Fix data race when using shared variables (free threading)
In the free threading build, there's a race between wrapper re-use and
wrapper deallocation. This can happen with a static variable accessed by
multiple threads.
Fixing this requires using some private CPython APIs: _Py_TryIncref and
_PyObject_SetMaybeWeakref. The implementations of these functions are
included until they're made available as public ("unstable") APIs.
Fixes #5489
* style: pre-commit fixes
* Avoid unused parameter
* Add missing return for default build
* Changes from review
* Assign result to local variable
* s/clang-tidy/ruff
* clang-tidy: static is redundant
* Use 'noqa: B018'
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>