We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d33563d commit ea677c3Copy full SHA for ea677c3
include/pybind11/detail/internals.h
@@ -445,6 +445,9 @@ inline uint64_t round_up_to_next_pow2(uint64_t x) {
445
446
template <typename InternalsType>
447
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
451
// Ensure that the GIL is held since we will need to make Python calls.
452
// Cannot use py::gil_scoped_acquire here since that constructor calls get_internals.
453
struct gil_scoped_acquire_local {
@@ -454,6 +457,7 @@ inline InternalsType **find_or_create_internals_pp(char const *state_dict_key) {
454
457
~gil_scoped_acquire_local() { PyGILState_Release(state); }
455
458
const PyGILState_STATE state;
456
459
} gil;
460
+#endif
461
462
error_scope err_scope;
463
0 commit comments