Permalink
Browse files

After a SyntaxError in code run by run_cell, only increment execution…

… count where we would normally.

Closes gh-633
  • Loading branch information...
1 parent d7d57eb commit a9d69f23648df1906acc066b02f371715a9c0411 @takluyver committed Nov 30, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 IPython/core/interactiveshell.py
@@ -2371,12 +2371,14 @@ def run_cell(self, raw_cell, store_history=False):
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,

0 comments on commit a9d69f2

Please sign in to comment.