Use a bit better warnings for tokenizer errors.

This commit is contained in:
Dave Halter
2017-08-03 21:48:04 +02:00
parent 8cebfc3e8a
commit e62a88b190
2 changed files with 25 additions and 9 deletions

View File

@@ -106,6 +106,12 @@ FAILING_EXAMPLES = [
r'b"\x"',
r'b"\"',
# Parser/tokenize.c
r'"""',
r'"',
r"'''",
r"'",
# SyntaxErrors from Python/symtable.c
'def f(x, x): pass',
'nonlocal a',
@@ -319,10 +325,6 @@ def _get_actual_exception(code):
if sys.version_info[:2] == (2, 6) and wanted == 'SyntaxError: unexpected EOF while parsing':
wanted = 'SyntaxError: invalid syntax'
if wanted == 'SyntaxError: EOL while scanning string literal':
# TODO This is not what we want in the future. Remove this.
wanted = 'SyntaxError: invalid syntax'
if wanted == 'SyntaxError: non-keyword arg after keyword arg':
# The python 3.5+ way, a bit nicer.
wanted = 'SyntaxError: positional argument follows keyword argument'