mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
handle errors in callbacks
This commit is contained in:
parent
5116b02e68
commit
38ffb5232f
@ -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>());
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user