File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 99
1010#pragma once
1111
12+ #include " ../gil.h"
1213#include " ../pytypes.h"
1314
1415#include < exception>
@@ -408,15 +409,7 @@ PYBIND11_NOINLINE internals &get_internals() {
408409 return **internals_pp;
409410 }
410411
411- // Ensure that the GIL is held since we will need to make Python calls.
412- // Cannot use py::gil_scoped_acquire here since that constructor calls get_internals.
413- struct gil_scoped_acquire_local {
414- gil_scoped_acquire_local () : state(PyGILState_Ensure()) {}
415- gil_scoped_acquire_local (const gil_scoped_acquire_local &) = delete ;
416- gil_scoped_acquire_local &operator =(const gil_scoped_acquire_local &) = delete ;
417- ~gil_scoped_acquire_local () { PyGILState_Release (state); }
418- const PyGILState_STATE state;
419- } gil;
412+ gil_scoped_acquire gil;
420413 error_scope err_scope;
421414
422415 PYBIND11_STR_TYPE id (PYBIND11_INTERNALS_ID);
You can’t perform that action at this time.
0 commit comments