File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 342342#define PYBIND11_STRINGIFY (x ) #x
343343#define PYBIND11_TOSTRING (x ) PYBIND11_STRINGIFY(x)
344344#define PYBIND11_CONCAT (first, second ) first##second
345- #define PYBIND11_ENSURE_INTERNALS_READY pybind11::detail::get_internals ();
345+ #define PYBIND11_ENSURE_INTERNALS_READY \
346+ { \
347+ pybind11::detail::get_internals_pp_manager ().unref (); \
348+ pybind11::detail::get_internals (); \
349+ }
346350
347351#if !defined(GRAALVM_PYTHON)
348352# define PYBIND11_PYCFUNCTION_GET_DOC (func ) ((func)->m_ml->ml_doc)
Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ class internals_pp_manager {
518518#if PYBIND11_HAS_SUBINTERPRETER_SUPPORT
519519 if (get_num_interpreters_seen () > 1 ) {
520520 auto *tstate = get_thread_state_unchecked ();
521- // this could be called without an active interpreter, that's OK, just use what we
521+ // this could be called without an active interpreter, just use what was cached
522522 if (!tstate || tstate->interp == last_istate_.get ()) {
523523 auto tpp = internals_tls_p_.get ();
524524 if (tpp) {
@@ -529,11 +529,7 @@ class internals_pp_manager {
529529 return ;
530530 }
531531#endif
532- // we can never delete the main interpreter PP because other modules may hold a copy of it
533- if (internals_singleton_pp_) {
534- // but we CAN and DO delete the internals inside.
535- internals_singleton_pp_->reset ();
536- }
532+ delete internals_singleton_pp_;
537533 unref ();
538534 }
539535
You can’t perform that action at this time.
0 commit comments