From d4c564efe9e504f7e92af66fb51ec8623ad80ba1 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 2 Mar 2024 22:54:32 +0100 Subject: [PATCH] Gui: PythonWrapper: Make qt_getCppType more robust Handle gracefully possible shiboken's Python API changes. --- src/Gui/PythonWrapper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Gui/PythonWrapper.cpp b/src/Gui/PythonWrapper.cpp index dc4d3df9bb..3a1a2ef622 100644 --- a/src/Gui/PythonWrapper.cpp +++ b/src/Gui/PythonWrapper.cpp @@ -471,6 +471,9 @@ qttype* qt_getCppType(PyObject* pyobj) // https://github.com/PySide/Shiboken/blob/master/shibokenmodule/typesystem_shiboken.xml Py::Module mainmod(importShiboken(), true); Py::Callable func = mainmod.getDict().getItem("getCppPointer"); + if (func.isNull()) { + throw Py::RuntimeError("Failed to get C++ pointer"); + } Py::Tuple arguments(1); arguments[0] = Py::Object(pyobj); // PySide pointer