##// END OF EJS Templates
Simplify code with a context manager
Thomas Kluyver -
Show More
@@ -344,13 +344,10 b' class TerminalInteractiveShell(InteractiveShell):'
344 344 self.showtraceback()
345 345 else:
346 346 try:
347 f = open(err.filename)
348 try:
347 with open(err.filename) as f:
349 348 # This should be inside a display_trap block and I
350 349 # think it is.
351 350 sys.displayhook(f.read())
352 finally:
353 f.close()
354 351 except:
355 352 self.showtraceback()
356 353
General Comments 0
You need to be logged in to leave comments. Login now