Skip to content

Commit ea677c3

Browse files
committed
Put back the SIMPLE_GIL ifdef
1 parent d33563d commit ea677c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/pybind11/detail/internals.h

+4
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ inline uint64_t round_up_to_next_pow2(uint64_t x) {
445445

446446
template <typename InternalsType>
447447
inline InternalsType **find_or_create_internals_pp(char const *state_dict_key) {
448+
#if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
449+
gil_scoped_acquire gil;
450+
#else
448451
// Ensure that the GIL is held since we will need to make Python calls.
449452
// Cannot use py::gil_scoped_acquire here since that constructor calls get_internals.
450453
struct gil_scoped_acquire_local {
@@ -454,6 +457,7 @@ inline InternalsType **find_or_create_internals_pp(char const *state_dict_key) {
454457
~gil_scoped_acquire_local() { PyGILState_Release(state); }
455458
const PyGILState_STATE state;
456459
} gil;
460+
#endif
457461

458462
error_scope err_scope;
459463

0 commit comments

Comments
 (0)