We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd34df2 commit da1762eCopy full SHA for da1762e
c++/cpp2py/converters/function.hpp
@@ -1,5 +1,6 @@
1
#pragma once
2
#include <functional>
3
+#include "./../misc.hpp"
4
5
namespace cpp2py {
6
@@ -185,6 +186,9 @@ namespace cpp2py {
185
186
pyref py_fnt = borrowed(ob);
187
auto l = [py_fnt](T... x) mutable -> R { // py_fnt is a pyref, it will keep the ref and manage the ref counting...
188
pyref ret = PyObject_CallFunctionObjArgs(py_fnt, (PyObject *)pyref(convert_to_python(x))..., NULL);
189
+ if (not py_converter<R>::is_convertible(ret, false)) {
190
+ CPP2PY_RUNTIME_ERROR << "\n Cannot convert function result " << to_string(ret) << " from python to C++";
191
+ }
192
return py_converter<R>::py2c(ret);
193
};
194
return l;
0 commit comments