--- a/eric6/E5Gui/E5ErrorMessage.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/E5Gui/E5ErrorMessage.py Thu Apr 15 18:11:24 2021 +0200 @@ -7,6 +7,8 @@ Module implementing a specialized error message dialog. """ +import contextlib + from PyQt5.QtCore import ( qInstallMessageHandler, QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QThread, QMetaObject, Qt, Q_ARG, QSettings @@ -118,7 +120,7 @@ # just ignore the message return - try: + with contextlib.suppress(RuntimeError): if msgType == QtDebugMsg: messageType = "Debug Message:" elif msgType == QtWarningMsg: @@ -154,8 +156,6 @@ Qt.ConnectionType.QueuedConnection, Q_ARG(str, msg)) return - except RuntimeError: - pass elif _origMsgHandler: _origMsgHandler(msgType, message) return