mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
fix dangling thread state issue (#5870)
* fix dangling thread state issue * formatting rules * use tstate .set(nullptr) to pass clang-tidy check * fix spelling mistake * improve comments for maintainability
This commit is contained in:
@@ -286,8 +286,8 @@ struct internals {
|
||||
internals()
|
||||
: static_property_type(make_static_property_type()),
|
||||
default_metaclass(make_default_metaclass()) {
|
||||
tstate.set(nullptr); // See PR #5870
|
||||
PyThreadState *cur_tstate = PyThreadState_Get();
|
||||
tstate = cur_tstate;
|
||||
|
||||
istate = cur_tstate->interp;
|
||||
registered_exception_translators.push_front(&translate_exception);
|
||||
|
||||
@@ -271,7 +271,7 @@ inline subinterpreter_scoped_activate::subinterpreter_scoped_activate(subinterpr
|
||||
// make the interpreter active and acquire the GIL
|
||||
old_tstate_ = PyThreadState_Swap(tstate_);
|
||||
|
||||
// save this in internals for scoped_gil calls
|
||||
// save this in internals for scoped_gil calls (see also: PR #5870)
|
||||
detail::get_internals().tstate = tstate_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user