@@ -421,8 +421,8 @@ inline PyThreadState *get_thread_state_unchecked() {
421421// / We use this to figure out if there are or have been multiple subinterpreters active at any
422422// / point. This must never go from true to false while any interpreter may be running in any
423423// / thread!
424- inline std::atomic< bool > & get_multiple_interpreters_seen () {
425- static std::atomic< bool > multi (false );
424+ inline std::atomic_bool & has_seen_non_main_interpreter () {
425+ static std::atomic_bool multi (false );
426426 return multi;
427427}
428428
@@ -650,7 +650,7 @@ class internals_pp_manager {
650650 // / acquire the GIL. Will never return nullptr.
651651 std::unique_ptr<InternalsType> *get_pp () {
652652#ifdef PYBIND11_HAS_SUBINTERPRETER_SUPPORT
653- if (get_multiple_interpreters_seen ()) {
653+ if (has_seen_non_main_interpreter ()) {
654654 // Whenever the interpreter changes on the current thread we need to invalidate the
655655 // internals_pp so that it can be pulled from the interpreter's state dict. That is
656656 // slow, so we use the current PyThreadState to check if it is necessary.
@@ -676,7 +676,7 @@ class internals_pp_manager {
676676 // / Drop all the references we're currently holding.
677677 void unref () {
678678#ifdef PYBIND11_HAS_SUBINTERPRETER_SUPPORT
679- if (get_multiple_interpreters_seen ()) {
679+ if (has_seen_non_main_interpreter ()) {
680680 last_istate_tls () = nullptr ;
681681 internals_p_tls () = nullptr ;
682682 return ;
@@ -687,7 +687,7 @@ class internals_pp_manager {
687687
688688 void destroy () {
689689#ifdef PYBIND11_HAS_SUBINTERPRETER_SUPPORT
690- if (get_multiple_interpreters_seen ()) {
690+ if (has_seen_non_main_interpreter ()) {
691691 auto *tstate = get_thread_state_unchecked ();
692692 // this could be called without an active interpreter, just use what was cached
693693 if (!tstate || tstate->interp == last_istate_tls ()) {
@@ -796,7 +796,7 @@ inline void ensure_internals() {
796796 pybind11::detail::get_internals_pp_manager ().unref ();
797797#ifdef PYBIND11_HAS_SUBINTERPRETER_SUPPORT
798798 if (PyInterpreterState_Get () != PyInterpreterState_Main ()) {
799- get_multiple_interpreters_seen () = true ;
799+ has_seen_non_main_interpreter () = true ;
800800 }
801801#endif
802802 pybind11::detail::get_internals ();
0 commit comments