mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 05:34:51 +08:00
Python 3.4 fixes.
This commit is contained in:
@@ -356,14 +356,20 @@ class ErrorFinder(Normalizer):
|
|||||||
arg_set = set()
|
arg_set = set()
|
||||||
kw_only = False
|
kw_only = False
|
||||||
kw_unpacking_only = False
|
kw_unpacking_only = False
|
||||||
|
is_old_starred = False
|
||||||
# In python 3 this would be a bit easier (stars are part of
|
# In python 3 this would be a bit easier (stars are part of
|
||||||
# argument), but we have to understand both.
|
# argument), but we have to understand both.
|
||||||
for argument in node.children:
|
for argument in node.children:
|
||||||
if argument == ',':
|
if argument == ',':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if argument in ('*', '**'):
|
if argument in ('*', '**'):
|
||||||
# Python 2 has the order engraved in the grammar file.
|
# Python < 3.5 has the order engraved in the grammar
|
||||||
# No need to do anything here.
|
# file. No need to do anything here.
|
||||||
|
is_old_starred = True
|
||||||
|
continue
|
||||||
|
if is_old_starred:
|
||||||
|
is_old_starred = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if argument.type == 'argument':
|
if argument.type == 'argument':
|
||||||
|
|||||||
@@ -292,6 +292,10 @@ def _get_actual_exception(code):
|
|||||||
# Python 2.6 has a bit different error messages here, so skip it.
|
# Python 2.6 has a bit different error messages here, so skip it.
|
||||||
if sys.version_info[:2] == (2, 6) and wanted == 'SyntaxError: unexpected EOF while parsing':
|
if sys.version_info[:2] == (2, 6) and wanted == 'SyntaxError: unexpected EOF while parsing':
|
||||||
wanted = 'SyntaxError: invalid syntax'
|
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'
|
||||||
return wanted, line_nr
|
return wanted, line_nr
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user