Fix ConsoleWidget to work with changed stack format in python 3

This commit is contained in:
Luke Campagnola 2018-02-01 11:42:01 -08:00
parent e65ab3faa5
commit a17d4a6e15

View File

@ -357,6 +357,11 @@ class ConsoleWidget(QtGui.QWidget):
# Build stack up to this point # Build stack up to this point
for index, line in enumerate(traceback.extract_stack(frame)): for index, line in enumerate(traceback.extract_stack(frame)):
# extract_stack return value changed in python 3.5
if 'FrameSummary' in str(type(line)):
print(dir(line))
line = (line.filename, line.lineno, line.name, line._line)
self.ui.exceptionStackList.addItem('File "%s", line %s, in %s()\n %s' % line) self.ui.exceptionStackList.addItem('File "%s", line %s, in %s()\n %s' % line)
while frame is not None: while frame is not None:
self.frames.insert(0, frame) self.frames.insert(0, frame)
@ -373,6 +378,11 @@ class ConsoleWidget(QtGui.QWidget):
# And finish the rest of the stack up to the exception # And finish the rest of the stack up to the exception
for index, line in enumerate(traceback.extract_tb(tb)): for index, line in enumerate(traceback.extract_tb(tb)):
# extract_stack return value changed in python 3.5
if 'FrameSummary' in str(type(line)):
print(dir(line))
line = (line.filename, line.lineno, line.name, line._line)
self.ui.exceptionStackList.addItem('File "%s", line %s, in %s()\n %s' % line) self.ui.exceptionStackList.addItem('File "%s", line %s, in %s()\n %s' % line)
while tb is not None: while tb is not None:
self.frames.append(tb.tb_frame) self.frames.append(tb.tb_frame)