mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +00:00
79cb013f1f
* Avoid thread termination in scoped_released Do not call `PyEval_RestoreThread()` from `~gil_scoped_release()` if python runtime is finalizing, as it will result in thread termination in Python runtime newer than 3.6, as documented in https://docs.python.org/3/c-api/init.html#c.PyEval_RestoreThread Similarly do not call `PyThreadState_DeleteCurrent` from `~gil_scoped_acquire()` if runtime is finalizing. Discovered while debugging PyTorch crash using Python-3.9 described in https://github.com/pytorch/pytorch/issues/47776 * Simplify _Py_IsFinalizing() availability check * Fix typo * Add version agnostic `detail::finalization_guard()` * Move `finalization_guard` to detail/common.h And rename it to `is_finalizing` * Move `is_finalizing()` back to pybind11.h * Simplify `is_finalizing()` check One should follow documentation rather than make any assumptions * feat: disarm * docs: fix comment Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com> |
||
---|---|---|
.. | ||
pybind11 |