diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 8abecb8c5..03c105063 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -411,8 +411,9 @@ inline object get_internals_state_dict() { # else PyInterpreterState *istate = PyInterpreterState_Get(); # endif - if (istate) + if (istate) { state_dict = reinterpret_borrow(PyInterpreterState_GetDict(istate)); + } #endif if (!state_dict) { raise_from(PyExc_SystemError, "get_internals(): could not acquire state dictionary!");