mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-23 17:09:27 +00:00
Remove PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT, set PYBIND11_INTERNALS_VERSION 7
This commit is contained in:
parent
28b74da35d
commit
3670868825
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -101,20 +101,6 @@ jobs:
|
|||||||
python: '3.12'
|
python: '3.12'
|
||||||
args: >
|
args: >
|
||||||
-DCMAKE_CXX_FLAGS="/DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT /GR /EHsc"
|
-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:
|
exclude:
|
||||||
# The setup-python action currently doesn't have graalpy for windows
|
# The setup-python action currently doesn't have graalpy for windows
|
||||||
- python: 'graalpy-24.1'
|
- python: 'graalpy-24.1'
|
||||||
|
@ -339,9 +339,7 @@ struct type_record {
|
|||||||
/// Solves pybind/pybind11#1446
|
/// Solves pybind/pybind11#1446
|
||||||
bool release_gil_before_calling_cpp_dtor : 1;
|
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;
|
holder_enum_t holder_enum_v = holder_enum_t::undefined;
|
||||||
#endif
|
|
||||||
|
|
||||||
PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *) ) {
|
PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *) ) {
|
||||||
auto *base_info = detail::get_type_info(base, false);
|
auto *base_info = detail::get_type_info(base, false);
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
// Additional convention: 0xD = dev
|
// Additional convention: 0xD = dev
|
||||||
#define PYBIND11_VERSION_HEX 0x030000D1
|
#define PYBIND11_VERSION_HEX 0x030000D1
|
||||||
|
|
||||||
|
#define PYBIND11_SMART_HOLDER_ENABLED // TODO(rwgk): purge
|
||||||
|
|
||||||
// Define some generic pybind11 helper macros for warning management.
|
// Define some generic pybind11 helper macros for warning management.
|
||||||
//
|
//
|
||||||
// Note that compiler-specific push/pop pairs are baked into the
|
// Note that compiler-specific push/pop pairs are baked into the
|
||||||
@ -605,11 +607,8 @@ struct instance {
|
|||||||
bool simple_instance_registered : 1;
|
bool simple_instance_registered : 1;
|
||||||
/// If true, get_internals().patients has an entry for this object
|
/// If true, get_internals().patients has an entry for this object
|
||||||
bool has_patients : 1;
|
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.
|
/// If true, this Python object needs to be kept alive for the lifetime of the C++ value.
|
||||||
bool is_alias : 1;
|
bool is_alias : 1;
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Initializes all of the above type/values/holders data (but not the instance values
|
/// Initializes all of the above type/values/holders data (but not the instance values
|
||||||
/// themselves)
|
/// themselves)
|
||||||
|
@ -37,15 +37,11 @@
|
|||||||
/// further ABI-incompatible changes may be made before the ABI is officially
|
/// further ABI-incompatible changes may be made before the ABI is officially
|
||||||
/// changed to the new version.
|
/// changed to the new version.
|
||||||
#ifndef PYBIND11_INTERNALS_VERSION
|
#ifndef PYBIND11_INTERNALS_VERSION
|
||||||
# if PYBIND11_VERSION_MAJOR >= 3
|
# define PYBIND11_INTERNALS_VERSION 7
|
||||||
# define PYBIND11_INTERNALS_VERSION 106
|
|
||||||
# else
|
|
||||||
# define PYBIND11_INTERNALS_VERSION 6
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PYBIND11_INTERNALS_VERSION < 6
|
#if PYBIND11_INTERNALS_VERSION < 7
|
||||||
# error "PYBIND11_INTERNALS_VERSION 6 is the minimum for all platforms for pybind11v3."
|
# error "PYBIND11_INTERNALS_VERSION 7 is the minimum for all platforms for pybind11v3."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
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 {
|
enum class holder_enum_t : uint8_t {
|
||||||
undefined,
|
undefined,
|
||||||
std_unique_ptr, // Default, lacking interop with std::shared_ptr.
|
std_unique_ptr, // Default, lacking interop with std::shared_ptr.
|
||||||
@ -227,13 +219,6 @@ enum class holder_enum_t : uint8_t {
|
|||||||
custom_holder,
|
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.
|
/// Additional type information which does not fit into the PyTypeObject.
|
||||||
/// Changes to this struct also require bumping `PYBIND11_INTERNALS_VERSION`.
|
/// Changes to this struct also require bumping `PYBIND11_INTERNALS_VERSION`.
|
||||||
struct type_info {
|
struct type_info {
|
||||||
@ -262,9 +247,7 @@ struct type_info {
|
|||||||
bool default_holder : 1;
|
bool default_holder : 1;
|
||||||
/* true if this is a type registered with py::module_local */
|
/* true if this is a type registered with py::module_local */
|
||||||
bool module_local : 1;
|
bool module_local : 1;
|
||||||
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
|
|
||||||
holder_enum_t holder_enum_v = holder_enum_t::undefined;
|
holder_enum_t holder_enum_v = holder_enum_t::undefined;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PYBIND11_INTERNALS_ID \
|
#define PYBIND11_INTERNALS_ID \
|
||||||
|
@ -1448,9 +1448,7 @@ protected:
|
|||||||
tinfo->simple_ancestors = true;
|
tinfo->simple_ancestors = true;
|
||||||
tinfo->default_holder = rec.default_holder;
|
tinfo->default_holder = rec.default_holder;
|
||||||
tinfo->module_local = rec.module_local;
|
tinfo->module_local = rec.module_local;
|
||||||
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
|
|
||||||
tinfo->holder_enum_v = rec.holder_enum_v;
|
tinfo->holder_enum_v = rec.holder_enum_v;
|
||||||
#endif
|
|
||||||
|
|
||||||
with_internals([&](internals &internals) {
|
with_internals([&](internals &internals) {
|
||||||
auto tindex = std::type_index(*rec.type);
|
auto tindex = std::type_index(*rec.type);
|
||||||
|
Loading…
Reference in New Issue
Block a user