mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-30 00:47:12 +00:00
Merge pull request #262 from merlinND/make-tuple-error-message
More informative error message when `py::make_tuple` fails
This commit is contained in:
commit
3b48482f02
@ -838,9 +838,16 @@ template <return_value_policy policy = return_value_policy::automatic_reference,
|
|||||||
{ object(detail::type_caster<typename detail::intrinsic_type<Args>::type>::cast(
|
{ object(detail::type_caster<typename detail::intrinsic_type<Args>::type>::cast(
|
||||||
std::forward<Args>(args_), policy, nullptr), false)... }
|
std::forward<Args>(args_), policy, nullptr), false)... }
|
||||||
};
|
};
|
||||||
for (auto &arg_value : args)
|
for (auto &arg_value : args) {
|
||||||
if (!arg_value)
|
if (!arg_value) {
|
||||||
throw cast_error("make_tuple(): unable to convert arguments to Python objects");
|
#if defined(NDEBUG)
|
||||||
|
throw cast_error("make_tuple(): unable to convert arguments to Python object (compile in debug mode for details)");
|
||||||
|
#else
|
||||||
|
throw cast_error("make_tuple(): unable to convert arguments of types '" +
|
||||||
|
(std::string) type_id<std::tuple<Args...>>() + "' to Python object");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
tuple result(size);
|
tuple result(size);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (auto &arg_value : args)
|
for (auto &arg_value : args)
|
||||||
|
Loading…
Reference in New Issue
Block a user