diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c8906451..36d564e78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,20 +101,6 @@ jobs: python: '3.12' args: > -DCMAKE_CXX_FLAGS="/DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT /GR /EHsc" - # Exercise PYBIND11_SMART_HOLDER_DISABLE - # with recent (or ideally latest) released Python version. - - runs-on: ubuntu-latest - python: '3.12' - args: > - -DCMAKE_CXX_FLAGS="-DPYBIND11_SMART_HOLDER_DISABLE" - - runs-on: macos-13 - python: '3.12' - args: > - -DCMAKE_CXX_FLAGS="-DPYBIND11_SMART_HOLDER_DISABLE" - - runs-on: windows-2022 - python: '3.12' - args: > - -DCMAKE_CXX_FLAGS="/DPYBIND11_SMART_HOLDER_DISABLE /GR /EHsc" exclude: # The setup-python action currently doesn't have graalpy for windows - python: 'graalpy-24.1' diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index dc9570f92..5380fd555 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -339,9 +339,7 @@ struct type_record { /// Solves pybind/pybind11#1446 bool release_gil_before_calling_cpp_dtor : 1; -#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT holder_enum_t holder_enum_v = holder_enum_t::undefined; -#endif PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *) ) { auto *base_info = detail::get_type_info(base, false); diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index eab3e1c0d..765812a4b 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -22,6 +22,8 @@ // Additional convention: 0xD = dev #define PYBIND11_VERSION_HEX 0x030000D1 +#define PYBIND11_SMART_HOLDER_ENABLED // TODO(rwgk): purge + // Define some generic pybind11 helper macros for warning management. // // Note that compiler-specific push/pop pairs are baked into the @@ -605,11 +607,8 @@ struct instance { bool simple_instance_registered : 1; /// If true, get_internals().patients has an entry for this object bool has_patients : 1; -// Cannot use PYBIND11_INTERNALS_VERSION >= 106 here without refactoring. -#if PYBIND11_VERSION_MAJOR >= 3 /// If true, this Python object needs to be kept alive for the lifetime of the C++ value. bool is_alias : 1; -#endif /// Initializes all of the above type/values/holders data (but not the instance values /// themselves) diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index beba642aa..a206b17dd 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -37,15 +37,11 @@ /// further ABI-incompatible changes may be made before the ABI is officially /// changed to the new version. #ifndef PYBIND11_INTERNALS_VERSION -# if PYBIND11_VERSION_MAJOR >= 3 -# define PYBIND11_INTERNALS_VERSION 106 -# else -# define PYBIND11_INTERNALS_VERSION 6 -# endif +# define PYBIND11_INTERNALS_VERSION 7 #endif -#if PYBIND11_INTERNALS_VERSION < 6 -# error "PYBIND11_INTERNALS_VERSION 6 is the minimum for all platforms for pybind11v3." +#if PYBIND11_INTERNALS_VERSION < 7 +# error "PYBIND11_INTERNALS_VERSION 7 is the minimum for all platforms for pybind11v3." #endif PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) @@ -215,10 +211,6 @@ struct internals { } }; -#if PYBIND11_INTERNALS_VERSION >= 106 - -# define PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT - enum class holder_enum_t : uint8_t { undefined, std_unique_ptr, // Default, lacking interop with std::shared_ptr. @@ -227,13 +219,6 @@ enum class holder_enum_t : uint8_t { custom_holder, }; -#endif - -#if defined(PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT) \ - && !defined(PYBIND11_SMART_HOLDER_DISABLE) -# define PYBIND11_SMART_HOLDER_ENABLED -#endif - /// Additional type information which does not fit into the PyTypeObject. /// Changes to this struct also require bumping `PYBIND11_INTERNALS_VERSION`. struct type_info { @@ -262,9 +247,7 @@ struct type_info { bool default_holder : 1; /* true if this is a type registered with py::module_local */ bool module_local : 1; -#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT holder_enum_t holder_enum_v = holder_enum_t::undefined; -#endif }; #define PYBIND11_INTERNALS_ID \ diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index a09aafec6..dfbcbcf0f 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1448,9 +1448,7 @@ protected: tinfo->simple_ancestors = true; tinfo->default_holder = rec.default_holder; tinfo->module_local = rec.module_local; -#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT tinfo->holder_enum_v = rec.holder_enum_v; -#endif with_internals([&](internals &internals) { auto tindex = std::type_index(*rec.type);