Commit 38ffb523 by Wenzel Jakob

handle errors in callbacks

parent 5116b02e
...@@ -25,6 +25,8 @@ public: ...@@ -25,6 +25,8 @@ public:
object src(src_, true); object src(src_, true);
value = [src](Args... args) -> Return { value = [src](Args... args) -> Return {
object retval(pybind::handle(src).call(std::move(args)...)); object retval(pybind::handle(src).call(std::move(args)...));
if (retval.ptr() == nullptr && PyErr_Occurred())
throw error_already_set();
/* Visual studio 2015 parser issue: need parentheses around this expression */ /* Visual studio 2015 parser issue: need parentheses around this expression */
return (retval.template cast<Return>()); return (retval.template cast<Return>());
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment