Skip to content

Commit

Permalink
prepare for PyCXX 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 18, 2018
1 parent c4aaef4 commit 840c9e8
Show file tree
Hide file tree
Showing 36 changed files with 226 additions and 239 deletions.
5 changes: 5 additions & 0 deletions src/Base/PyObjectBase.h
Expand Up @@ -51,6 +51,11 @@

#include <typeinfo>
#include "Exception.h"
#if PY_MAJOR_VERSION > 2
# ifndef PYCXX_PYTHON_2TO3
# define PYCXX_PYTHON_2TO3
# endif
#endif
#include <CXX/Objects.hxx>


Expand Down
2 changes: 1 addition & 1 deletion src/Base/Sequencer.cpp
Expand Up @@ -367,7 +367,7 @@ Py::Object ProgressIndicatorPy::next(const Py::Tuple& args)
}
catch (const Base::AbortException&) {
_seq.reset();
throw Py::Exception("abort progress indicator");
throw Py::RuntimeError("abort progress indicator");
}
}
return Py::None();
Expand Down
2 changes: 1 addition & 1 deletion src/Base/VectorPyImp.cpp
Expand Up @@ -613,7 +613,7 @@ void VectorPy::setLength(Py::Float arg)
VectorPy::PointerType ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
double len = ptr->Length();
if (len < 1.0e-6) {
throw Py::Exception(std::string("Cannot set length of null vector"));
throw Py::RuntimeError(std::string("Cannot set length of null vector"));
}

double val = (double)arg/len;
Expand Down
56 changes: 28 additions & 28 deletions src/Gui/SplitView3DInventor.cpp
Expand Up @@ -450,7 +450,7 @@ AbstractSplitViewPy::~AbstractSplitViewPy()
void AbstractSplitViewPy::testExistence()
{
if (!(_view && _view->getViewer(0)))
throw Py::Exception("Object already deleted");
throw Py::RuntimeError("Object already deleted");
}

Py::Object AbstractSplitViewPy::repr()
Expand All @@ -473,13 +473,13 @@ Py::Object AbstractSplitViewPy::fitAll(const Py::Tuple& args)
_view->onMsg("ViewFit", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}
return Py::None();
}
Expand All @@ -494,13 +494,13 @@ Py::Object AbstractSplitViewPy::viewBottom(const Py::Tuple& args)
_view->onMsg("ViewBottom", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -516,13 +516,13 @@ Py::Object AbstractSplitViewPy::viewFront(const Py::Tuple& args)
_view->onMsg("ViewFront", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -538,13 +538,13 @@ Py::Object AbstractSplitViewPy::viewLeft(const Py::Tuple& args)
_view->onMsg("ViewLeft", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -560,13 +560,13 @@ Py::Object AbstractSplitViewPy::viewRear(const Py::Tuple& args)
_view->onMsg("ViewRear", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -582,13 +582,13 @@ Py::Object AbstractSplitViewPy::viewRight(const Py::Tuple& args)
_view->onMsg("ViewRight", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -604,13 +604,13 @@ Py::Object AbstractSplitViewPy::viewTop(const Py::Tuple& args)
_view->onMsg("ViewTop", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -626,13 +626,13 @@ Py::Object AbstractSplitViewPy::viewAxometric(const Py::Tuple& args)
_view->onMsg("ViewAxo", 0);
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}

return Py::None();
Expand All @@ -652,13 +652,13 @@ Py::Object AbstractSplitViewPy::getViewer(const Py::Tuple& args)
return Py::Object(view->getPyObject());
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
throw Py::RuntimeError(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
throw Py::RuntimeError("Unknown C++ exception");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Gui/TaskView/TaskDialogPython.cpp
Expand Up @@ -92,7 +92,7 @@ Py::Object ControlPy::showDialog(const Py::Tuple& args)
{
Gui::TaskView::TaskDialog* act = Gui::Control().activeDialog();
if (act)
throw Py::Exception("Active task dialog found");
throw Py::RuntimeError("Active task dialog found");
TaskDialogPython* dlg = new TaskDialogPython(args[0]);
Gui::Control().showDialog(dlg);
return Py::None();
Expand Down

0 comments on commit 840c9e8

Please sign in to comment.