diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-17 12:37:33 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-18 20:25:39 +0100 |
commit | 6b5e4bc3b53e997096b6f40f7bd4bc5a3f1e31e6 (patch) | |
tree | 9cb7b723e6fea4807e9b440a0ad5b1bc15ae049c /sources/pyside6/libpyside/pysidesignal.cpp | |
parent | 9bbbb29809ec7552698680a40e20ec271d929c67 (diff) |
Fix debug assert in test signals/bug_189.py
Do not use the %S-formatting directive when an error is already set,
since that will invoke str() and thus cause an error.
Amends d7aa15abe25bd71ea19180743ce9b41e0b788520.
Task-number: PYSIDE-1275
Change-Id: I1125ca254efdeeb3652d6171d71f3e22fb686a7a
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysidesignal.cpp')
-rw-r--r-- | sources/pyside6/libpyside/pysidesignal.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp index ecfb92d15..c93cbadfb 100644 --- a/sources/pyside6/libpyside/pysidesignal.cpp +++ b/sources/pyside6/libpyside/pysidesignal.cpp @@ -663,8 +663,13 @@ static PyObject *signalInstanceGetItem(PyObject *self, PyObject *key) static inline void warnDisconnectFailed(PyObject *aSlot, const QByteArray &signature) { - PyErr_WarnFormat(PyExc_RuntimeError, 0, "Failed to disconnect (%S) from signal \"%s\".", - aSlot, signature.constData()); + if (PyErr_Occurred() != nullptr) { // avoid "%S" invoking str() when an error is set. + PyErr_WarnFormat(PyExc_RuntimeError, 0, "Failed to disconnect (%s) from signal \"%s\".", + Py_TYPE(aSlot)->tp_name, signature.constData()); + } else { + PyErr_WarnFormat(PyExc_RuntimeError, 0, "Failed to disconnect (%S) from signal \"%s\".", + aSlot, signature.constData()); + } } static PyObject *signalInstanceDisconnect(PyObject *self, PyObject *args) |