Skip to content

Commit bd8985a

Browse files
authored
[smart_holder] Introduce PYBIND11_SMART_HOLDER_DISABLE option. (#5348)
* Step 1: Establish new `PYBIND11_SMART_HOLDER_ENABLED` macro, but only under include/pybind11/ At the stage `PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT` and `PYBIND11_SMART_HOLDER_ENABLED` are still equivalent. * Systematically replace all `PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT` with `PYBIND11_SMART_HOLDER_ENABLED` under tests/ and ubench/ As at the previous stage, `PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT` and `PYBIND11_SMART_HOLDER_ENABLED` are still equivalent. * Introduce `PYBIND11_SMART_HOLDER_DISABLE` option. * `#ifdef` out entire `wrap()` function to avoid `unused-parameter` warning-as-error under macos-13 ``` /Users/runner/work/pybind11/pybind11/tests/test_class_sh_trampoline_basic.cpp:67:23: error: unused parameter 'm' [-Werror,-Wunused-parameter] void wrap(py::module_ m, const char *py_class_name) { ^ /Users/runner/work/pybind11/pybind11/tests/test_class_sh_trampoline_basic.cpp:67:38: error: unused parameter 'py_class_name' [-Werror,-Wunused-parameter] void wrap(py::module_ m, const char *py_class_name) { ^ 2 errors generated. ```
1 parent a7b91e3 commit bd8985a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+123
-103
lines changed

.github/workflows/ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
# Extra ubuntu latest job
6969
- runs-on: ubuntu-latest
7070
python: '3.11'
71+
# Exercise PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
72+
# with recent (or ideally latest) released Python version.
7173
- runs-on: ubuntu-latest
7274
python: '3.12'
7375
args: >
@@ -80,6 +82,20 @@ jobs:
8082
python: '3.12'
8183
args: >
8284
-DCMAKE_CXX_FLAGS="/DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT /GR /EHsc"
85+
# Exercise PYBIND11_SMART_HOLDER_DISABLE
86+
# with recent (or ideally latest) released Python version.
87+
- runs-on: ubuntu-latest
88+
python: '3.12'
89+
args: >
90+
-DCMAKE_CXX_FLAGS="-DPYBIND11_SMART_HOLDER_DISABLE"
91+
- runs-on: macos-13
92+
python: '3.12'
93+
args: >
94+
-DCMAKE_CXX_FLAGS="-DPYBIND11_SMART_HOLDER_DISABLE"
95+
- runs-on: windows-2022
96+
python: '3.12'
97+
args: >
98+
-DCMAKE_CXX_FLAGS="/DPYBIND11_SMART_HOLDER_DISABLE /GR /EHsc"
8399
84100
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
85101
runs-on: ${{ matrix.runs-on }}

include/pybind11/cast.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ struct copyable_holder_caster : public type_caster_base<type> {
836836
holder_type holder;
837837
};
838838

839-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
839+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
840840

841841
template <typename, typename SFINAE = void>
842842
struct copyable_holder_caster_shared_ptr_with_smart_holder_support_enabled : std::true_type {};
@@ -968,7 +968,7 @@ struct copyable_holder_caster<
968968
std::shared_ptr<type> shared_ptr_storage;
969969
};
970970

971-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
971+
#endif // PYBIND11_SMART_HOLDER_ENABLED
972972

973973
/// Specialize for the common std::shared_ptr, so users don't need to
974974
template <typename T>
@@ -990,7 +990,7 @@ struct move_only_holder_caster {
990990
static constexpr auto name = type_caster_base<type>::name;
991991
};
992992

993-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
993+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
994994

995995
template <typename, typename SFINAE = void>
996996
struct move_only_holder_caster_unique_ptr_with_smart_holder_support_enabled : std::true_type {};
@@ -1129,7 +1129,7 @@ struct move_only_holder_caster<
11291129
std::shared_ptr<std::unique_ptr<type, deleter>> unique_ptr_storage;
11301130
};
11311131

1132-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
1132+
#endif // PYBIND11_SMART_HOLDER_ENABLED
11331133

11341134
template <typename type, typename deleter>
11351135
class type_caster<std::unique_ptr<type, deleter>>
@@ -1167,7 +1167,7 @@ struct is_holder_type
11671167
template <typename base, typename deleter>
11681168
struct is_holder_type<base, std::unique_ptr<base, deleter>> : std::true_type {};
11691169

1170-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
1170+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
11711171
template <typename base>
11721172
struct is_holder_type<base, smart_holder> : std::true_type {};
11731173
#endif

include/pybind11/detail/init.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
198198
v_h.value_ptr() = new Alias<Class>(std::move(result));
199199
}
200200

201-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
201+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
202202

203203
template <typename T, typename D>
204204
smart_holder init_smart_holder_from_unique_ptr(std::unique_ptr<T, D> &&unq_ptr,
@@ -268,7 +268,7 @@ void construct(value_and_holder &v_h,
268268
v_h.type->init_instance(v_h.inst, &smhldr);
269269
}
270270

271-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
271+
#endif // PYBIND11_SMART_HOLDER_ENABLED
272272

273273
// Implementing class for py::init<...>()
274274
template <typename... Args>

include/pybind11/detail/internals.h

+5
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ enum class holder_enum_t : uint8_t {
252252

253253
#endif
254254

255+
#if defined(PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT) \
256+
&& !defined(PYBIND11_SMART_HOLDER_DISABLE)
257+
# define PYBIND11_SMART_HOLDER_ENABLED
258+
#endif
259+
255260
/// Additional type information which does not fit into the PyTypeObject.
256261
/// Changes to this struct also require bumping `PYBIND11_INTERNALS_VERSION`.
257262
struct type_info {

include/pybind11/detail/type_caster_base.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ inline PyThreadState *get_thread_state_unchecked() {
473473
void keep_alive_impl(handle nurse, handle patient);
474474
inline PyObject *make_new_instance(PyTypeObject *type);
475475

476-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
476+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
477477

478478
// PYBIND11:REMINDER: Needs refactoring of existing pybind11 code.
479479
inline bool deregister_instance(instance *self, void *valptr, const type_info *tinfo);
@@ -830,7 +830,7 @@ struct load_helper : value_and_holder_helper {
830830

831831
PYBIND11_NAMESPACE_END(smart_holder_type_caster_support)
832832

833-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
833+
#endif // PYBIND11_SMART_HOLDER_ENABLED
834834

835835
class type_caster_generic {
836836
public:
@@ -936,7 +936,7 @@ class type_caster_generic {
936936

937937
// Base methods for generic caster; there are overridden in copyable_holder_caster
938938
void load_value(value_and_holder &&v_h) {
939-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
939+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
940940
if (typeinfo->holder_enum_v == detail::holder_enum_t::smart_holder) {
941941
smart_holder_type_caster_support::value_and_holder_helper v_h_helper;
942942
v_h_helper.loaded_v_h = v_h;

include/pybind11/detail/using_smart_holder.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010
#include <type_traits>
1111

12-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
12+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
1313
# include "struct_smart_holder.h"
1414
#endif
1515

1616
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
1717

18-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
18+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
1919
using pybindit::memory::smart_holder;
2020
#endif
2121

2222
PYBIND11_NAMESPACE_BEGIN(detail)
2323

24-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
24+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
2525
template <typename H>
2626
using is_smart_holder = std::is_same<H, smart_holder>;
2727
#else

include/pybind11/pybind11.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ PYBIND11_NAMESPACE_END(detail)
16311631
template <typename T, typename D, typename SFINAE = void>
16321632
struct property_cpp_function : detail::property_cpp_function_classic<T, D> {};
16331633

1634-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
1634+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
16351635

16361636
PYBIND11_NAMESPACE_BEGIN(detail)
16371637

@@ -1810,10 +1810,9 @@ struct property_cpp_function<
18101810
detail::both_t_and_d_use_type_caster_base<T, typename D::element_type>>::value>>
18111811
: detail::property_cpp_function_sh_unique_ptr_member<T, D> {};
18121812

1813-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
1813+
#endif // PYBIND11_SMART_HOLDER_ENABLED
18141814

1815-
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
1816-
&& defined(PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
1815+
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) && defined(PYBIND11_SMART_HOLDER_ENABLED)
18171816
// NOTE: THIS IS MEANT FOR STRESS-TESTING ONLY!
18181817
// As of PR #5257, for production use, there is no longer a strong reason to make
18191818
// smart_holder the default holder:
@@ -1881,7 +1880,7 @@ class class_ : public detail::generic_type {
18811880
// A more fitting name would be uses_unique_ptr_holder.
18821881
record.default_holder = detail::is_instantiation<std::unique_ptr, holder_type>::value;
18831882

1884-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
1883+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
18851884
if (detail::is_instantiation<std::unique_ptr, holder_type>::value) {
18861885
record.holder_enum_v = detail::holder_enum_t::std_unique_ptr;
18871886
} else if (detail::is_instantiation<std::shared_ptr, holder_type>::value) {
@@ -2226,7 +2225,7 @@ class class_ : public detail::generic_type {
22262225
init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
22272226
}
22282227

2229-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
2228+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
22302229

22312230
template <typename WrappedType>
22322231
static bool try_initialization_using_shared_from_this(holder_type *, WrappedType *, ...) {
@@ -2287,7 +2286,7 @@ class class_ : public detail::generic_type {
22872286
v_h.set_holder_constructed();
22882287
}
22892288

2290-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
2289+
#endif // PYBIND11_SMART_HOLDER_ENABLED
22912290

22922291
/// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
22932292
static void dealloc(detail::value_and_holder &v_h) {
@@ -2329,7 +2328,7 @@ class class_ : public detail::generic_type {
23292328
}
23302329
};
23312330

2332-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
2331+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
23332332

23342333
// Supports easier switching between py::class_<T> and py::class_<T, py::smart_holder>:
23352334
// users can simply replace the `_` in `class_` with `h` or vice versa.

include/pybind11/trampoline_self_life_support.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "detail/internals.h"
88

9-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
9+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
1010

1111
# include "detail/common.h"
1212
# include "detail/using_smart_holder.h"
@@ -63,4 +63,4 @@ struct trampoline_self_life_support {
6363

6464
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
6565

66-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
66+
#endif // PYBIND11_SMART_HOLDER_ENABLED

tests/test_class.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ TEST_SUBMODULE(class_, m) {
9393
struct ToBeHeldByUniquePtr {};
9494
py::class_<ToBeHeldByUniquePtr, std::unique_ptr<ToBeHeldByUniquePtr>>(m, "ToBeHeldByUniquePtr")
9595
.def(py::init<>());
96-
#ifdef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
96+
#ifdef PYBIND11_SMART_HOLDER_ENABLED
9797
m.def("pass_unique_ptr", [](std::unique_ptr<ToBeHeldByUniquePtr> &&) {});
9898
#else
9999
m.attr("pass_unique_ptr") = py::none();

tests/test_class_sh_basic.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ namespace pybind11_tests {
156156
namespace class_sh_basic {
157157

158158
TEST_SUBMODULE(class_sh_basic, m) {
159-
m.attr("defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
160-
#ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
159+
m.attr("defined_PYBIND11_SMART_HOLDER_ENABLED") =
160+
#ifndef PYBIND11_SMART_HOLDER_ENABLED
161161
false;
162162
#else
163163
true;
@@ -260,7 +260,7 @@ TEST_SUBMODULE(class_sh_basic, m) {
260260
[]() { return CastUnusualOpRefConstRef(LocalUnusualOpRef()); });
261261
m.def("CallCastUnusualOpRefMovable",
262262
[]() { return CastUnusualOpRefMovable(LocalUnusualOpRef()); });
263-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
263+
#endif // PYBIND11_SMART_HOLDER_ENABLED
264264
}
265265

266266
} // namespace class_sh_basic

tests/test_class_sh_basic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from pybind11_tests import class_sh_basic as m
99

10-
if not m.defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT:
10+
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
1111
pytest.skip("smart_holder not available.", allow_module_level=True)
1212

1313

tests/test_class_sh_disowning.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ PYBIND11_SMART_HOLDER_TYPE_CASTERS(pybind11_tests::class_sh_disowning::Atype<1>)
3232
PYBIND11_SMART_HOLDER_TYPE_CASTERS(pybind11_tests::class_sh_disowning::Atype<2>)
3333

3434
TEST_SUBMODULE(class_sh_disowning, m) {
35-
m.attr("defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
36-
#ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
35+
m.attr("defined_PYBIND11_SMART_HOLDER_ENABLED") =
36+
#ifndef PYBIND11_SMART_HOLDER_ENABLED
3737
false;
3838
#else
3939
true;
@@ -49,5 +49,5 @@ TEST_SUBMODULE(class_sh_disowning, m) {
4949

5050
m.def("overloaded", (int (*)(std::unique_ptr<Atype<1>>, int)) & overloaded);
5151
m.def("overloaded", (int (*)(std::unique_ptr<Atype<2>>, int)) & overloaded);
52-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
52+
#endif // PYBIND11_SMART_HOLDER_ENABLED
5353
}

tests/test_class_sh_disowning.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pybind11_tests import class_sh_disowning as m
66

7-
if not m.defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT:
7+
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
88
pytest.skip("smart_holder not available.", allow_module_level=True)
99

1010

tests/test_class_sh_disowning_mi.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ PYBIND11_SMART_HOLDER_TYPE_CASTERS(pybind11_tests::class_sh_disowning_mi::Base1)
5757
PYBIND11_SMART_HOLDER_TYPE_CASTERS(pybind11_tests::class_sh_disowning_mi::Base2)
5858

5959
TEST_SUBMODULE(class_sh_disowning_mi, m) {
60-
m.attr("defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
61-
#ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
60+
m.attr("defined_PYBIND11_SMART_HOLDER_ENABLED") =
61+
#ifndef PYBIND11_SMART_HOLDER_ENABLED
6262
false;
6363
#else
6464
true;
@@ -98,5 +98,5 @@ TEST_SUBMODULE(class_sh_disowning_mi, m) {
9898
py::classh<Base2>(m, "Base2").def(py::init<int>()).def("bar", &Base2::bar);
9999
m.def("disown_base1", disown_base1);
100100
m.def("disown_base2", disown_base2);
101-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
101+
#endif // PYBIND11_SMART_HOLDER_ENABLED
102102
}

tests/test_class_sh_disowning_mi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import env # noqa: F401
66
from pybind11_tests import class_sh_disowning_mi as m
77

8-
if not m.defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT:
8+
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
99
pytest.skip("smart_holder not available.", allow_module_level=True)
1010

1111

tests/test_class_sh_factory_constructors.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ PYBIND11_SMART_HOLDER_TYPE_CASTERS(pybind11_tests::class_sh_factory_constructors
8787
PYBIND11_SMART_HOLDER_TYPE_CASTERS(pybind11_tests::class_sh_factory_constructors::with_alias)
8888

8989
TEST_SUBMODULE(class_sh_factory_constructors, m) {
90-
m.attr("defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
91-
#ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
90+
m.attr("defined_PYBIND11_SMART_HOLDER_ENABLED") =
91+
#ifndef PYBIND11_SMART_HOLDER_ENABLED
9292
false;
9393
#else
9494
true;
@@ -183,5 +183,5 @@ TEST_SUBMODULE(class_sh_factory_constructors, m) {
183183
[](int, int, int, int, int) {
184184
return std::make_shared<with_alias>(); // Invalid alias factory.
185185
}));
186-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
186+
#endif // PYBIND11_SMART_HOLDER_ENABLED
187187
}

tests/test_class_sh_factory_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pybind11_tests import class_sh_factory_constructors as m
66

7-
if not m.defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT:
7+
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
88
pytest.skip("smart_holder not available.", allow_module_level=True)
99

1010

tests/test_class_sh_inheritance.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ namespace pybind11_tests {
7373
namespace class_sh_inheritance {
7474

7575
TEST_SUBMODULE(class_sh_inheritance, m) {
76-
m.attr("defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
77-
#ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
76+
m.attr("defined_PYBIND11_SMART_HOLDER_ENABLED") =
77+
#ifndef PYBIND11_SMART_HOLDER_ENABLED
7878
false;
7979
#else
8080
true;
@@ -105,7 +105,7 @@ TEST_SUBMODULE(class_sh_inheritance, m) {
105105
m.def("pass_cptr_base1", pass_cptr_base1);
106106
m.def("pass_cptr_base2", pass_cptr_base2);
107107
m.def("pass_cptr_drvd2", pass_cptr_drvd2);
108-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
108+
#endif // PYBIND11_SMART_HOLDER_ENABLED
109109
}
110110

111111
} // namespace class_sh_inheritance

tests/test_class_sh_inheritance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pybind11_tests import class_sh_inheritance as m
66

7-
if not m.defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT:
7+
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
88
pytest.skip("smart_holder not available.", allow_module_level=True)
99

1010

tests/test_class_sh_mi_thunks.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ PYBIND11_SMART_HOLDER_TYPE_CASTERS(test_class_sh_mi_thunks::Base1)
4040
PYBIND11_SMART_HOLDER_TYPE_CASTERS(test_class_sh_mi_thunks::Derived)
4141

4242
TEST_SUBMODULE(class_sh_mi_thunks, m) {
43-
m.attr("defined_PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT") =
44-
#ifndef PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
43+
m.attr("defined_PYBIND11_SMART_HOLDER_ENABLED") =
44+
#ifndef PYBIND11_SMART_HOLDER_ENABLED
4545
false;
4646
#else
4747
true;
@@ -103,5 +103,5 @@ TEST_SUBMODULE(class_sh_mi_thunks, m) {
103103
}
104104
return obj_der->vec.size();
105105
});
106-
#endif // PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT
106+
#endif // PYBIND11_SMART_HOLDER_ENABLED
107107
}

0 commit comments

Comments
 (0)