We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 074daf0 commit d2863f5Copy full SHA for d2863f5
include/pybind11/gil.h
@@ -120,7 +120,11 @@ class gil_scoped_acquire {
120
pybind11_fail("scoped_acquire::dec_ref(): internal error!");
121
}
122
# endif
123
+ // Make sure that PyThreadState_Clear is not recursively called by finalizers.
124
+ // See issue #5827
125
+ ++tstate->gilstate_counter;
126
PyThreadState_Clear(tstate);
127
+ --tstate->gilstate_counter;
128
if (active) {
129
PyThreadState_DeleteCurrent();
130
0 commit comments