Skip to content
Snippets Groups Projects
Commit 63f59901 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

functionPython : when an error occurs in python code executed from c, print it and exit

parent 770266d8
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,14 @@ class functionPython : public function {
{
R.setAsProxy(res);
R.setDataCacheMap(m);
PyEval_CallObject(_pycallback, _pyargs);
PyObject *result = PyEval_CallObject(_pycallback, _pyargs);
if (result) {
Py_DECREF(result);
}
else {
PyErr_Print();
Msg::Fatal("An error occurs in the python function.");
}
}
functionPython (int nbCol, PyObject *callback, std::vector<const function*> dependencies)
: function(nbCol), _pycallback(callback)
......
......@@ -24,7 +24,7 @@
#endif
std::cout<<level<<" : "<<message<<std::endl;
if (level == "Fatal")
throw;
Msg::Exit(1);
}
};
%}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment