diff -r 39e3db2b4936 -r eefe954f01e8 eric6/Debugger/CallTraceViewer.py --- a/eric6/Debugger/CallTraceViewer.py Sun Jul 05 11:11:24 2020 +0200 +++ b/eric6/Debugger/CallTraceViewer.py Sun Oct 18 12:35:30 2020 +0200 @@ -7,8 +7,9 @@ Module implementing the Call Trace viewer widget. """ +import re -from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QRegExp, QFileInfo +from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QFileInfo from PyQt5.QtWidgets import QWidget, QTreeWidgetItem from E5Gui.E5Application import e5App @@ -63,7 +64,7 @@ self.__callStack = [] self.__entryFormat = "{0}:{1} ({2})" - self.__entryRe = QRegExp(r"""(.+):(\d+)\s\((.*)\)""") + self.__entryRe = re.compile(r"""(.+):(\d+)\s\((.*)\)""") self.__projectMode = False self.__project = None @@ -176,19 +177,18 @@ fname = Utilities.toNativeSeparators(fname) try: - f = open(fname, "w", encoding="utf-8") - itm = self.callTrace.topLevelItem(0) - while itm is not None: - isCall = itm.data(0, Qt.UserRole) - if isCall: - call = "->" - else: - call = "<-" - f.write("{0} {1} || {2}\n".format( - call, - itm.text(1), itm.text(2))) - itm = self.callTrace.itemBelow(itm) - f.close() + with open(fname, "w", encoding="utf-8") as f: + itm = self.callTrace.topLevelItem(0) + while itm is not None: + isCall = itm.data(0, Qt.UserRole) + if isCall: + call = "->" + else: + call = "<-" + f.write("{0} {1} || {2}\n".format( + call, + itm.text(1), itm.text(2))) + itm = self.callTrace.itemBelow(itm) except IOError as err: E5MessageBox.critical( self, @@ -210,8 +210,9 @@ """ if item is not None and column > 0: columnStr = item.text(column) - if self.__entryRe.exactMatch(columnStr.strip()): - filename, lineno, func = self.__entryRe.capturedTexts()[1:] + match = self.__entryRe.fullmatch(columnStr.strip()) + if match: + filename, lineno, func = match.groups() try: lineno = int(lineno) except ValueError: