##// END OF EJS Templates
move execution_count bump to error_before_exec...
Min RK -
Show More
@@ -2696,6 +2696,8 b' class InteractiveShell(SingletonConfigurable):'
2696 result.execution_count = self.execution_count
2696 result.execution_count = self.execution_count
2697
2697
2698 def error_before_exec(value):
2698 def error_before_exec(value):
2699 if store_history:
2700 self.execution_count += 1
2699 result.error_before_exec = value
2701 result.error_before_exec = value
2700 self.last_execution_succeeded = False
2702 self.last_execution_succeeded = False
2701 self.last_execution_result = result
2703 self.last_execution_result = result
@@ -2752,33 +2754,25 b' class InteractiveShell(SingletonConfigurable):'
2752
2754
2753 with self.display_trap:
2755 with self.display_trap:
2754 # Compile to bytecode
2756 # Compile to bytecode
2755 ast_error = None
2756 try:
2757 try:
2757 code_ast = compiler.ast_parse(cell, filename=cell_name)
2758 code_ast = compiler.ast_parse(cell, filename=cell_name)
2758 except self.custom_exceptions as e:
2759 except self.custom_exceptions as e:
2759 etype, value, tb = sys.exc_info()
2760 etype, value, tb = sys.exc_info()
2760 self.CustomTB(etype, value, tb)
2761 self.CustomTB(etype, value, tb)
2761 ast_error = e
2762 return error_before_exec(e)
2762 except IndentationError as e:
2763 except IndentationError as e:
2763 self.showindentationerror()
2764 self.showindentationerror()
2764 ast_error = e
2765 return error_before_exec(e)
2765 except (OverflowError, SyntaxError, ValueError, TypeError,
2766 except (OverflowError, SyntaxError, ValueError, TypeError,
2766 MemoryError) as e:
2767 MemoryError) as e:
2767 self.showsyntaxerror()
2768 self.showsyntaxerror()
2768 ast_error = e
2769 return error_before_exec(e)
2769
2770 if ast_error is not None:
2771 if store_history:
2772 self.execution_count += 1
2773 return error_before_exec(ast_error)
2774
2770
2775 # Apply AST transformations
2771 # Apply AST transformations
2776 try:
2772 try:
2777 code_ast = self.transform_ast(code_ast)
2773 code_ast = self.transform_ast(code_ast)
2778 except InputRejected as e:
2774 except InputRejected as e:
2779 self.showtraceback()
2775 self.showtraceback()
2780 if store_history:
2781 self.execution_count += 1
2782 return error_before_exec(e)
2776 return error_before_exec(e)
2783
2777
2784 # Give the displayhook a reference to our ExecutionResult so it
2778 # Give the displayhook a reference to our ExecutionResult so it
General Comments 0
You need to be logged in to leave comments. Login now