[pypy-svn] pypy fast-forward: At EOF, point the error to the last line of the file
amauryfa
commits-noreply at bitbucket.org
Thu Jan 13 11:44:56 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40635:742ebffee312
Date: 2011-01-12 20:07 +0100
http://bitbucket.org/pypy/pypy/changeset/742ebffee312/
Log: At EOF, point the error to the last line of the file
diff --git a/pypy/interpreter/pyparser/test/test_pyparse.py b/pypy/interpreter/pyparser/test/test_pyparse.py
--- a/pypy/interpreter/pyparser/test/test_pyparse.py
+++ b/pypy/interpreter/pyparser/test/test_pyparse.py
@@ -79,6 +79,7 @@
assert exc.msg == "EOF while scanning triple-quoted string literal"
assert exc.lineno == 1
assert exc.offset == 5
+ assert exc.lastlineno == 3
for input in ("())", "(()", "((", "))"):
py.test.raises(SyntaxError, parse, input)
exc = py.test.raises(SyntaxError, parse, "x = (\n\n(),\n(),").value
diff --git a/pypy/interpreter/pyparser/pytokenizer.py b/pypy/interpreter/pyparser/pytokenizer.py
--- a/pypy/interpreter/pyparser/pytokenizer.py
+++ b/pypy/interpreter/pyparser/pytokenizer.py
@@ -96,7 +96,7 @@
raise TokenError(
"EOF while scanning triple-quoted string literal",
strstart[2], strstart[0], strstart[1]+1,
- token_list, lnum)
+ token_list, lnum-1)
endmatch = endDFA.recognize(line)
if endmatch >= 0:
pos = end = endmatch
More information about the Pypy-commit
mailing list