Skip to content

Commit

Permalink
test_class.cpp: simpler approach, leveraging new `PYBIND11_ACTUALLY_U…
Browse files Browse the repository at this point in the history
…SING_SMART_HOLDER_AS_DEFAULT`
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Jul 21, 2024
1 parent d0003f5 commit 89d0ddd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 1 addition & 0 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,7 @@ struct property_cpp_function<
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
// BAKEIN_WIP: Add comment to explain: This is meant for stress-testing only.
# define PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
template <typename>
using default_holder_type = smart_holder;
#else
Expand Down
9 changes: 1 addition & 8 deletions tests/test_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,17 +607,10 @@ CHECK_NOALIAS(8);
static_assert(std::is_same<typename DoesntBreak##N::holder_type, \
std::TYPE##_ptr<BreaksBase<(N)>>>::value, \
"DoesntBreak" #N " has wrong holder_type!")
#define CHECK_SMART_HOLDER(N) \
static_assert(std::is_same<typename DoesntBreak##N::holder_type, py::smart_holder>::value, \
"DoesntBreak" #N " has wrong holder_type!")
CHECK_HOLDER(1, unique);
CHECK_HOLDER(2, unique);
CHECK_HOLDER(3, unique);
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
CHECK_SMART_HOLDER(4);
CHECK_SMART_HOLDER(5);
#else
#ifndef PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
CHECK_HOLDER(4, unique);
CHECK_HOLDER(5, unique);
#endif
Expand Down

0 comments on commit 89d0ddd

Please sign in to comment.