Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: pyparser-improvements-2
Changeset: r94274:0682e48513a0
Date: 2018-04-07 14:19 +0200
http://bitbucket.org/pypy/pypy/changeset/0682e48513a0/

Log:    fix position of error

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
@@ -171,7 +171,7 @@
 
                 if start == end:
                     raise TokenError("Unknown character", line,
-                                     lnum, start + 1, token_list)
+                                     lnum, start, token_list)
 
                 pos = end
                 token, initial = line[start:end], line[start]
diff --git a/pypy/interpreter/pyparser/test/test_pytokenizer.py 
b/pypy/interpreter/pyparser/test/test_pytokenizer.py
--- a/pypy/interpreter/pyparser/test/test_pytokenizer.py
+++ b/pypy/interpreter/pyparser/test/test_pytokenizer.py
@@ -49,3 +49,6 @@
                 assert error.value.lineno == 1
                 assert error.value.lastlineno == 2
 
+
+    def test_unknown_char(self):
+        check_token_error("?", "Unknown character", 0)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to