aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/plugins/designer/designercustomwidgets.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/sources/pyside6/plugins/designer/designercustomwidgets.cpp b/sources/pyside6/plugins/designer/designercustomwidgets.cpp
index 07faa5b02..d13539859 100644
--- a/sources/pyside6/plugins/designer/designercustomwidgets.cpp
+++ b/sources/pyside6/plugins/designer/designercustomwidgets.cpp
@@ -57,6 +57,7 @@ static QString pyStr(PyObject *o)
static QString pyErrorMessage()
{
QString result = "<error information not available>"_L1;
+#if (defined(Py_LIMITED_API) && Py_LIMITED_API < 0x030C0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX < 0x030C0000)
PyObject *ptype = {};
PyObject *pvalue = {};
PyObject *ptraceback = {};
@@ -64,6 +65,12 @@ static QString pyErrorMessage()
if (pvalue != nullptr)
result = pyStr(pvalue);
PyErr_Restore(ptype, pvalue, ptraceback);
+#else // <3.11
+ if (PyObject *pvalue = PyErr_GetRaisedException()) {
+ result = pyStr(pvalue);
+ Py_DECREF(pvalue);
+ }
+#endif
return result;
}