--- a/eric6/Debugger/DebugUI.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/Debugger/DebugUI.py Thu Apr 15 18:11:24 2021 +0200 @@ -9,6 +9,7 @@ import os import copy +import contextlib from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt from PyQt5.QtGui import QKeySequence @@ -1235,22 +1236,18 @@ ): res = None if stackTrace: - try: + with contextlib.suppress(UnicodeError, OSError): file, line = stackTrace[0][:2] source, encoding = Utilities.readEncodedFile(file) source = source.splitlines(True) if len(source) >= line: lineFlags = Utilities.extractLineFlags( source[line - 1].strip()) - try: + with contextlib.suppress(IndexError): lineFlags += Utilities.extractLineFlags( source[line].strip(), flagsLine=True) - except IndexError: - pass if "__IGNORE_EXCEPTION__" in lineFlags: res = E5MessageBox.No - except (UnicodeError, OSError): - pass if res != E5MessageBox.No: self.viewmanager.setFileLine( stackTrace[0][0], stackTrace[0][1], True)