Skip to content

Commit

Permalink
Use PYBIND11_DETAILED_ERROR_MESSAGES in smart_holder_type_casters.h (…
Browse files Browse the repository at this point in the history
…follow-on to pybind#3913)
  • Loading branch information
Ralf W. Grosse-Kunstleve committed May 5, 2022
1 parent 0157cb4 commit 72f51e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/pybind11/detail/smart_holder_type_casters.h
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,10 @@ struct smart_holder_type_caster : smart_holder_type_caster_load<T>,
if (copy_constructor) {
valueptr = copy_constructor(src);
} else {
#if defined(NDEBUG)
#if !defined(PYBIND11_DETAILED_ERROR_MESSAGES)
throw cast_error("return_value_policy = copy, but type is "
"non-copyable! (compile in debug mode for details)");
"non-copyable! (#define PYBIND11_DETAILED_ERROR_MESSAGES or "
"compile in debug mode for details)");
#else
std::string type_name(tinfo->cpptype->name());
detail::clean_type_id(type_name);
Expand All @@ -741,10 +742,11 @@ struct smart_holder_type_caster : smart_holder_type_caster_load<T>,
} else if (copy_constructor) {
valueptr = copy_constructor(src);
} else {
#if defined(NDEBUG)
#if !defined(PYBIND11_DETAILED_ERROR_MESSAGES)
throw cast_error("return_value_policy = move, but type is neither "
"movable nor copyable! "
"(compile in debug mode for details)");
"(#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in "
"debug mode for details)");
#else
std::string type_name(tinfo->cpptype->name());
detail::clean_type_id(type_name);
Expand Down

0 comments on commit 72f51e1

Please sign in to comment.