diff --git a/parso/python/errors.py b/parso/python/errors.py index b0cc29a..6fb7f67 100644 --- a/parso/python/errors.py +++ b/parso/python/errors.py @@ -981,6 +981,8 @@ class _CheckAssignmentRule(SyntaxRule): or '_test' in type_ or type_ in ('term', 'factor')): error = 'operator' + elif type_ == "star_expr": + self._check_assignment(node.children[1]) if error is not None: if is_namedexpr: diff --git a/test/normalizer_issue_files/allowed_syntax.py b/test/normalizer_issue_files/allowed_syntax.py index 9ac0a6d..a73b84c 100644 --- a/test/normalizer_issue_files/allowed_syntax.py +++ b/test/normalizer_issue_files/allowed_syntax.py @@ -12,13 +12,6 @@ from .__future__ import absolute_import ''r''u'' b'' BR'' -for x in [1]: - try: - continue # Only the other continue and pass is an error. - finally: - #: E901 - continue - for x in [1]: break diff --git a/test/test_python_errors.py b/test/test_python_errors.py index bf00d57..26d9e6e 100644 --- a/test/test_python_errors.py +++ b/test/test_python_errors.py @@ -339,3 +339,26 @@ def test_continue_in_finally(): assert _get_error_list(code, version="3.7") +@pytest.mark.parametrize( + 'template', [ + "a, b, {target}, c = d", + "a, b, *{target}, c = d", + "(a, *{target}), c = d", + "for x, {target} in y: pass", + "for x, q, {target} in y: pass", + "for x, q, *{target} in y: pass", + "for (x, *{target}), q in y: pass", + ] +) +@pytest.mark.parametrize( + 'target', [ + "True", + "False", + "None", + "__debug__" + ] +) +def test_forbidden_name(template, target): + assert _get_error_list(template.format(target=target), version="3")[0].message + +