From 587b76641883cb3954aabc7d560dada1933630da Mon Sep 17 00:00:00 2001 From: "Lackner, Christopher" Date: Thu, 10 Oct 2024 09:17:11 +0200 Subject: [PATCH] also allow building with older pybind11 without py::set_error --- libsrc/occ/python_occ.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsrc/occ/python_occ.cpp b/libsrc/occ/python_occ.cpp index 2d4fefcd..e94020f1 100644 --- a/libsrc/occ/python_occ.cpp +++ b/libsrc/occ/python_occ.cpp @@ -86,7 +86,11 @@ DLL_HEADER void ExportNgOCC(py::module &m) try { if(p) std::rethrow_exception(p); } catch (const Standard_Failure& e) { +#if (PYBIND11_VERSION_MAJOR == 2 && PYBIND11_VERSION_MINOR < 12) + exc((string(e.DynamicType()->Name()) + ": " + e.GetMessageString()).c_str()); +#else py::set_error(PyExc_RuntimeError, (string(e.DynamicType()->Name()) + ": " + e.GetMessageString()).c_str()); +#endif } });