From ff2b1e76b2bf8d7e298b34f83669f70290292f4a Mon Sep 17 00:00:00 2001 From: Niko Fink Date: Sun, 24 Oct 2021 12:03:14 +0200 Subject: [PATCH] report type of passed argument when conversion fails --- src/CPPMethod.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CPPMethod.cxx b/src/CPPMethod.cxx index 958cf212..61837bf4 100644 --- a/src/CPPMethod.cxx +++ b/src/CPPMethod.cxx @@ -831,8 +831,10 @@ bool CPyCppyy::CPPMethod::ConvertAndSetArgs(CPyCppyy_PyArgs_t args, size_t nargs bool isOK = true; Parameter* cppArgs = ctxt->GetArgs(argc); for (int i = 0; i < (int)argc; ++i) { - if (!fConverters[i]->SetArg(CPyCppyy_PyArgs_GET_ITEM(args, i), cppArgs[i], ctxt)) { - SetPyError_(CPyCppyy_PyText_FromFormat("could not convert argument %d", i+1)); + PyObject *item = CPyCppyy_PyArgs_GET_ITEM(args, i); + if (!fConverters[i]->SetArg(item, cppArgs[i], ctxt)) { + std::string s = Utility::ClassName(item); + SetPyError_(CPyCppyy_PyText_FromFormat("could not convert argument %d of type %s", i+1, s.c_str())); isOK = false; break; }