correctly handle again NotImplementedError in Python view providers
This commit is contained in:
@@ -453,6 +453,12 @@ ViewProviderPythonFeatureImp::setEdit(int ModNum)
|
||||
}
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
// If an explicit NotImplementedError is raised then
|
||||
// handle it differently to other RuntimeError
|
||||
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
|
||||
PyErr_Clear();
|
||||
return NotImplemented;
|
||||
}
|
||||
// If a runtime error occurred when calling setEdit
|
||||
// then handle it like returning false
|
||||
if (PyErr_ExceptionMatches(PyExc_RuntimeError)) {
|
||||
@@ -503,6 +509,18 @@ ViewProviderPythonFeatureImp::unsetEdit(int ModNum)
|
||||
}
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
// If an explicit NotImplementedError is raised then
|
||||
// handle it differently to other RuntimeError
|
||||
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
|
||||
PyErr_Clear();
|
||||
return NotImplemented;
|
||||
}
|
||||
// If a runtime error occurred when calling setEdit
|
||||
// then handle it like returning false
|
||||
if (PyErr_ExceptionMatches(PyExc_RuntimeError)) {
|
||||
PyErr_Clear();
|
||||
return Rejected;
|
||||
}
|
||||
Base::PyException e; // extract the Python error text
|
||||
e.ReportException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user