From 762b0eaa90a382c109314a8fa9358766f56c8d78 2011-12-05 23:57:44 From: Thomas Kluyver Date: 2011-12-05 23:57:44 Subject: [PATCH] After a SyntaxError in code run by run_cell, only increment execution count where we would normally. Closes gh-633 closes gh-1070 --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index e660c16..bb3ffc1 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2405,12 +2405,14 @@ class InteractiveShell(SingletonConfigurable, Magic): code_ast = self.compile.ast_parse(cell, filename=cell_name) except IndentationError: self.showindentationerror() - self.execution_count += 1 + if store_history: + self.execution_count += 1 return None except (OverflowError, SyntaxError, ValueError, TypeError, MemoryError): self.showsyntaxerror() - self.execution_count += 1 + if store_history: + self.execution_count += 1 return None self.run_ast_nodes(code_ast.body, cell_name,