Skip to content

Commit

Permalink
Base: do not report C++ exception when converting it to Python exception
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 11, 2021
1 parent e01f0d2 commit 111a21e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/Base/PyObjectBase.h
Expand Up @@ -463,12 +463,10 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort;
#define __PY_CATCH(R) \
catch(Base::AbortException &e) \
{ \
e.ReportException(); \
_Py_ErrorObj(R,Base::BaseExceptionFreeCADAbort,e.getPyObject());\
} \
catch(Base::Exception &e) \
{ \
e.ReportException(); \
auto pye = e.getPyExceptionType(); \
if(!pye) \
pye = Base::BaseExceptionFreeCADError; \
Expand Down
1 change: 0 additions & 1 deletion src/Mod/Part/App/OCCError.h
Expand Up @@ -80,7 +80,6 @@ PartExport extern PyObject* PartExceptionOCCDimensionError;
str += " "; \
if (msg) {str += msg;} \
else {str += "No OCCT Exception Message";} \
Base::Console().Error(str.c_str()); \
_Py_Error(R,Part::PartExceptionOCCError,str.c_str()); \
} \
_PY_CATCH(R)
Expand Down
6 changes: 0 additions & 6 deletions src/Tools/generateTemplates/templateClassPyExport.py
Expand Up @@ -615,13 +615,11 @@ class @self.export.Namespace.replace("::","_")@Export @self.export.Name@ : publi
} // Please sync the following catch implementation with PY_CATCH
catch(Base::AbortException &e)
{
e.ReportException();
PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject());
return NULL;
}
catch(Base::Exception &e)
{
e.ReportException();
auto pye = e.getPyExceptionType();
if(!pye)
pye = Base::BaseExceptionFreeCADError;
Expand Down Expand Up @@ -790,13 +788,11 @@ class @self.export.Namespace.replace("::","_")@Export @self.export.Name@ : publi
} // Please sync the following catch implementation with PY_CATCH
catch(Base::AbortException &e)
{
e.ReportException();
PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject());
return NULL;
}
catch(Base::Exception &e)
{
e.ReportException();
auto pye = e.getPyExceptionType();
if(!pye)
pye = Base::BaseExceptionFreeCADError;
Expand Down Expand Up @@ -852,13 +848,11 @@ class @self.export.Namespace.replace("::","_")@Export @self.export.Name@ : publi
} // Please sync the following catch implementation with PY_CATCH
catch(Base::AbortException &e)
{
e.ReportException();
PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject());
return -1;
}
catch(Base::Exception &e)
{
e.ReportException();
auto pye = e.getPyExceptionType();
if(!pye)
pye = Base::BaseExceptionFreeCADError;
Expand Down

0 comments on commit 111a21e

Please sign in to comment.