diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-04-17 14:49:57 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-05-07 21:10:45 +0200 |
commit | d8ca812879ad70cd2aa914ea76cd529786deadc6 (patch) | |
tree | 97140467bca8c9bcda6f492ecb8598c9db136179 /sources/pyside6/libpyside/signalmanager.cpp | |
parent | cffe2bc71d8e5d88efb879e6fe68c730e547fc4d (diff) |
libshiboken: Add utility class for stashing Python errors
It encapsulates fetching/restoring errors and uses the old or new
exception API depending on version.
Task-number: PYSIDE-3067
Change-Id: I6e39d92c7e79fed864b364a90c5bd5b474a41ed6
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/libpyside/signalmanager.cpp')
-rw-r--r-- | sources/pyside6/libpyside/signalmanager.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sources/pyside6/libpyside/signalmanager.cpp b/sources/pyside6/libpyside/signalmanager.cpp index 342737c1b..933edd318 100644 --- a/sources/pyside6/libpyside/signalmanager.cpp +++ b/sources/pyside6/libpyside/signalmanager.cpp @@ -347,20 +347,15 @@ int SignalManagerPrivate::qtPropertyMetacall(QObject *object, if (PyErr_Occurred()) { // PYSIDE-2160: An unknown type was reported. Indicated by StopIteration. if (PyErr_ExceptionMatches(PyExc_StopIteration)) { - PyObject *excType{}; - PyObject *excValue{}; - PyObject *excTraceback{}; - PyErr_Fetch(&excType, &excValue, &excTraceback); + Shiboken::Errors::Stash errorStash; bool ign = call == QMetaObject::WriteProperty; PyErr_WarnFormat(PyExc_RuntimeWarning, 0, ign ? "Unknown property type '%s' of QObject '%s' used in fset" : "Unknown property type '%s' of QObject '%s' used in fget with %R", - pp->d->typeName.constData(), metaObject->className(), excValue); + pp->d->typeName.constData(), metaObject->className(), errorStash.getException()); if (PyErr_Occurred()) Shiboken::Errors::storeErrorOrPrint(); - Py_DECREF(excType); - Py_DECREF(excValue); - Py_XDECREF(excTraceback); + errorStash.release(); return result; } |