Merge pull request #627 from campagnola/console-stack-py3

Fix ConsoleWidget to work with changed stack format in python 3.5
This commit is contained in:
Luke Campagnola 2018-02-01 12:06:48 -08:00 committed by GitHub
commit 4ed09ebdf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)