Skip to content

Commit e1204b2

Browse files
committed
Work around older python versions, only need this check for newish versions
1 parent 857e4a5 commit e1204b2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

include/pybind11/detail/internals.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -794,14 +794,11 @@ PYBIND11_NOINLINE internals &get_internals() {
794794

795795
inline void ensure_internals() {
796796
pybind11::detail::get_internals_pp_manager().unref();
797-
#if PY_VERSION_HEX < 0x03090000
798-
PyInterpreterState *cur_istate = _PyInterpreterState_Get();
799-
#else
800-
PyInterpreterState *cur_istate = PyInterpreterState_Get();
801-
#endif
802-
if (cur_istate != PyInterpreterState_Main()) {
797+
#ifdef PYBIND11_HAS_SUBINTERPRETER_SUPPORT
798+
if (PyInterpreterState_Get() != PyInterpreterState_Main()) {
803799
get_multiple_interpreters_seen() = true;
804800
}
801+
#endif
805802
pybind11::detail::get_internals();
806803
}
807804

0 commit comments

Comments
 (0)