Skip to content

Commit 72f51e1

Browse files
committed
Use PYBIND11_DETAILED_ERROR_MESSAGES in smart_holder_type_casters.h (follow-on to #3913)
1 parent 0157cb4 commit 72f51e1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/pybind11/detail/smart_holder_type_casters.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,10 @@ struct smart_holder_type_caster : smart_holder_type_caster_load<T>,
722722
if (copy_constructor) {
723723
valueptr = copy_constructor(src);
724724
} else {
725-
#if defined(NDEBUG)
725+
#if !defined(PYBIND11_DETAILED_ERROR_MESSAGES)
726726
throw cast_error("return_value_policy = copy, but type is "
727-
"non-copyable! (compile in debug mode for details)");
727+
"non-copyable! (#define PYBIND11_DETAILED_ERROR_MESSAGES or "
728+
"compile in debug mode for details)");
728729
#else
729730
std::string type_name(tinfo->cpptype->name());
730731
detail::clean_type_id(type_name);
@@ -741,10 +742,11 @@ struct smart_holder_type_caster : smart_holder_type_caster_load<T>,
741742
} else if (copy_constructor) {
742743
valueptr = copy_constructor(src);
743744
} else {
744-
#if defined(NDEBUG)
745+
#if !defined(PYBIND11_DETAILED_ERROR_MESSAGES)
745746
throw cast_error("return_value_policy = move, but type is neither "
746747
"movable nor copyable! "
747-
"(compile in debug mode for details)");
748+
"(#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in "
749+
"debug mode for details)");
748750
#else
749751
std::string type_name(tinfo->cpptype->name());
750752
detail::clean_type_id(type_name);

0 commit comments

Comments
 (0)