Skip to content
This repository

Execution count after SyntaxError #1070

Closed
wants to merge 1 commit into from

3 participants

Thomas Kluyver Fernando Perez Min RK
Thomas Kluyver
Collaborator

After a SyntaxError in code run by run_cell, only increment execution count where we would normally (i.e. if store_history is True).

Trivial change, but it's right in our core machinery, so I thought I'd let someone else have a quick look.

Closes gh-633

Fernando Perez
Owner

Didn't last long without an open PR, heh? :) I'll have a look later today, thanks.

Thomas Kluyver takluyver closed this pull request from a commit November 30, 2011
Thomas Kluyver After a SyntaxError in code run by run_cell, only increment execution…
… count where we would normally.

Closes gh-633
closes gh-1070
762b0ea
Thomas Kluyver takluyver closed this in 762b0ea December 05, 2011
Min RK
Owner

Sensible, straightforward, merged.

Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 30, 2011
Thomas Kluyver After a SyntaxError in code run by run_cell, only increment execution…
… count where we would normally.

Closes gh-633
a9d69f2
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  IPython/core/interactiveshell.py
6  IPython/core/interactiveshell.py
@@ -2371,12 +2371,14 @@ def run_cell(self, raw_cell, store_history=False):
2371 2371
                         code_ast = self.compile.ast_parse(cell, filename=cell_name)
2372 2372
                     except IndentationError:
2373 2373
                         self.showindentationerror()
2374  
-                        self.execution_count += 1
  2374
+                        if store_history:
  2375
+                            self.execution_count += 1
2375 2376
                         return None
2376 2377
                     except (OverflowError, SyntaxError, ValueError, TypeError,
2377 2378
                             MemoryError):
2378 2379
                         self.showsyntaxerror()
2379  
-                        self.execution_count += 1
  2380
+                        if store_history:
  2381
+                            self.execution_count += 1
2380 2382
                         return None
2381 2383
 
2382 2384
                     self.run_ast_nodes(code_ast.body, cell_name,
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.