3939// / further ABI-incompatible changes may be made before the ABI is officially
4040// / changed to the new version.
4141#ifndef PYBIND11_INTERNALS_VERSION
42- # define PYBIND11_INTERNALS_VERSION 12
42+ # define PYBIND11_INTERNALS_VERSION 11
4343#endif
4444
4545#if PYBIND11_INTERNALS_VERSION < 11
@@ -347,18 +347,13 @@ struct internals {
347347// impact any other modules, because the only things accessing the local internals is the
348348// module that contains them.
349349struct local_internals {
350- local_internals () : istate(get_interpreter_state_unchecked()) {}
351-
352350 // It should be safe to use fast_type_map here because this entire
353351 // data structure is scoped to our single module, and thus a single
354352 // DSO and single instance of type_info for any particular type.
355353 fast_type_map<type_info *> registered_types_cpp;
356354
357355 std::forward_list<ExceptionTranslator> registered_exception_translators;
358356 PyTypeObject *function_record_py_type = nullptr ;
359- PyInterpreterState *istate = nullptr ;
360-
361- ~local_internals () = default ;
362357};
363358
364359enum class holder_enum_t : uint8_t {
@@ -806,8 +801,6 @@ PYBIND11_NOINLINE internals &get_internals() {
806801
807802// / Return the PyObject* for the internals capsule (borrowed reference).
808803// / Returns nullptr if the capsule doesn't exist yet.
809- // / This is used to prevent use-after-free during interpreter shutdown by allowing pybind11 types
810- // / to hold a reference to the capsule (see comments in generic_type::initialize).
811804inline PyObject *get_internals_capsule () {
812805 auto state_dict = reinterpret_borrow<dict>(get_python_state_dict ());
813806 return dict_getitemstring (state_dict.ptr (), PYBIND11_INTERNALS_ID);
@@ -825,8 +818,6 @@ inline const std::string &get_local_internals_key() {
825818
826819// / Return the PyObject* for the local_internals capsule (borrowed reference).
827820// / Returns nullptr if the capsule doesn't exist yet.
828- // / This is used to prevent use-after-free during interpreter shutdown by allowing pybind11 types
829- // / to hold a reference to the capsule (see comments in generic_type::initialize).
830821inline PyObject *get_local_internals_capsule () {
831822 const auto &key = get_local_internals_key ();
832823 auto state_dict = reinterpret_borrow<dict>(get_python_state_dict ());
0 commit comments