From 841a5d96b30868663918b9ad10c21cc7d4bfaa65 Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Sun, 21 Jun 2020 19:47:18 +0300 Subject: [PATCH] Update starred deletion messages for 3.9+ --- parso/python/errors.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/parso/python/errors.py b/parso/python/errors.py index d9183cb..c34995e 100644 --- a/parso/python/errors.py +++ b/parso/python/errors.py @@ -740,7 +740,10 @@ class _StarExprRule(SyntaxRule): class _StarExprParentRule(SyntaxRule): def is_issue(self, node): if node.parent.type == 'del_stmt': - self.add_issue(node.parent, message="can't use starred expression here") + if self._normalizer.version >= (3, 9): + self.add_issue(node.parent, message="cannot delete starred") + else: + self.add_issue(node.parent, message="can't use starred expression here") else: def is_definition(node, ancestor): if ancestor is None: @@ -1072,7 +1075,12 @@ class _CheckAssignmentRule(SyntaxRule): or type_ in ('term', 'factor')): error = 'operator' elif type_ == "star_expr": - if not search_ancestor(node, *_STAR_EXPR_PARENTS) and not is_aug_assign: + if is_deletion: + if self._normalizer.version >= (3, 9): + error = "starred" + else: + self.add_issue(node, message="can't use starred expression here") + elif not search_ancestor(node, *_STAR_EXPR_PARENTS) and not is_aug_assign: self.add_issue(node, message="starred assignment target must be in a list or tuple") self._check_assignment(node.children[1])