Clear the linecache before printing a traceback

This commit is contained in:
Guido van Rossum 1998-10-13 16:32:05 +00:00
parent 49c1a7ebc2
commit 1956352b08
1 changed files with 7 additions and 0 deletions

View File

@ -129,7 +129,14 @@ class ModifiedInterpreter(InteractiveInterpreter):
# Extend base class method to reset output properly # Extend base class method to reset output properly
text = self.tkconsole.text text = self.tkconsole.text
self.tkconsole.resetoutput() self.tkconsole.resetoutput()
self.checklinecache()
InteractiveInterpreter.showtraceback(self) InteractiveInterpreter.showtraceback(self)
def checklinecache(self):
c = linecache.cache
for key in c.keys():
if key[:1] + key[-1:] != "<>":
del c[key]
def runcode(self, code): def runcode(self, code):
# Override base class method # Override base class method