Show More
@@ -2352,6 +2352,7 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
2352 |
|
2352 | |||
2353 | exec_count = self.execution_count |
|
2353 | exec_count = self.execution_count | |
2354 |
|
2354 | |||
|
2355 | try: | |||
2355 | for i, node in enumerate(to_run_exec): |
|
2356 | for i, node in enumerate(to_run_exec): | |
2356 | mod = ast.Module([node]) |
|
2357 | mod = ast.Module([node]) | |
2357 | code = self.compile(mod, cell_name, "exec") |
|
2358 | code = self.compile(mod, cell_name, "exec") | |
@@ -2363,6 +2364,17 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
2363 | code = self.compile(mod, cell_name, "single") |
|
2364 | code = self.compile(mod, cell_name, "single") | |
2364 | if self.run_code(code): |
|
2365 | if self.run_code(code): | |
2365 | return True |
|
2366 | return True | |
|
2367 | except: | |||
|
2368 | # It's possible to have exceptions raised here, typically by | |||
|
2369 | # compilation of odd code (such as a naked 'return' outside a | |||
|
2370 | # function) that did parse but isn't valid. Typically the exception | |||
|
2371 | # is a SyntaxError, but it's safest just to catch anything and show | |||
|
2372 | # the user a traceback. | |||
|
2373 | ||||
|
2374 | # We do only one try/except outside the loop to minimize the impact | |||
|
2375 | # on runtime, and also because if any node in the node list is | |||
|
2376 | # broken, we should stop execution completely. | |||
|
2377 | self.showtraceback() | |||
2366 |
|
2378 | |||
2367 | return False |
|
2379 | return False | |
2368 |
|
2380 |
General Comments 0
You need to be logged in to leave comments.
Login now