Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix error message in test_irunner #431

Closed
wants to merge 1 commit into from

1 participant

@takluyver
Owner

This is a third pull request aimed at fixing issue #409, and (hopefully) supersedes PRs #427 and #424.

I'd introduced a subtle bug when I refactored the execution logic, that changed the error message showing in certain SyntaxErrors. Then I'd been a bit over-eager to get the tests passing, because I changed the failing test to match the new error message. That was really stupid, and I apologise.

When some of us started using Python 2.7, a change in that made the code produce the correct error message again. Specifically, code to be compiled in "exec" mode no longer needs to end in a newline. So the test, expecting the incorrect error message, failed.

This fixes the bug, and puts the message in the test back to the original. I've checked that the test suite passes in both Python 2.6 and 2.7.

@takluyver
Owner

Min's updated his PR #427, so this is now pretty much a duplicate.

@takluyver takluyver closed this pull request from a commit
@takluyver takluyver Fix subtle bug with error message on Python 2.6 - code to be compiled…
… must end in a newline.

closes gh-409
closes gh-424
closes gh-427
closes gh-431
f02a1aa
@takluyver takluyver closed this in f02a1aa
@ellisonbg ellisonbg referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this pull request from a commit in mattvonrocketstein/ipython
@takluyver takluyver Fix subtle bug with error message on Python 2.6 - code to be compiled…
… must end in a newline.

closes gh-409
closes gh-424
closes gh-427
closes gh-431
41f4aab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 11, 2011
  1. @takluyver
This page is out of date. Refresh to see the latest.
View
2  IPython/core/interactiveshell.py
@@ -2130,7 +2130,7 @@ def run_cell(self, raw_cell, store_history=True):
prefilter_failed = False
if len(cell.splitlines()) == 1:
try:
- cell = self.prefilter_manager.prefilter_lines(cell)
+ cell = self.prefilter_manager.prefilter_line(cell)
except AliasError as e:
error(e)
prefilter_failed=True
View
4 IPython/lib/tests/test_irunner.py
@@ -105,10 +105,10 @@ def testIPython(self):
Automatic calling is: OFF
In [8]: cos pi
- File "<ipython-input-8-586f1104ea44>", line 1
+ File "<ipython-input-8-6bd7313dd9a9>", line 1
cos pi
^
-SyntaxError: unexpected EOF while parsing
+SyntaxError: invalid syntax
In [9]: cos(pi)
Something went wrong with that request. Please try again.