diff --git a/parso/python/normalizer.py b/parso/python/normalizer.py index 7f10838..5b132af 100644 --- a/parso/python/normalizer.py +++ b/parso/python/normalizer.py @@ -231,6 +231,10 @@ class ErrorFinder(Normalizer): self._add_syntax_error(message, lhs.parent) else: self._add_syntax_error(message % type_, lhs.parent) + elif node.type == 'argument': + if node.children[1] == '=' and node.children[0].type != 'name': + message = "keyword can't be an expression" + self._add_syntax_error(message, node.children[0]) yield diff --git a/test/test_python_errors.py b/test/test_python_errors.py index d1521b6..82f5aa5 100644 --- a/test/test_python_errors.py +++ b/test/test_python_errors.py @@ -90,6 +90,7 @@ def test_indentation_errors(code, positions): '(a, b): int', '*star,: int', 'a, b: int = 3', + 'foo(+a=3)', # IndentationError ' foo',