mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-10 06:31:57 +08:00
Added issue: iterable unpacking cannot be used in comprehension
This commit is contained in:
@@ -136,6 +136,10 @@ class ErrorFinder(Normalizer):
|
||||
if node.parent.type not in _STAR_EXPR_PARENTS:
|
||||
message = "starred assignment target must be in a list or tuple"
|
||||
self._add_syntax_error(message, node)
|
||||
if node.parent.type == 'testlist_comp':
|
||||
# [*[] for a in [1]]
|
||||
message = "iterable unpacking cannot be used in comprehension"
|
||||
self._add_syntax_error(message, node)
|
||||
elif node.type == 'comp_for':
|
||||
if node.children[0] == 'async' \
|
||||
and not self._context.is_async_funcdef():
|
||||
|
||||
@@ -109,6 +109,7 @@ def test_python_exception_matches(code):
|
||||
('del *a, b', '3.5'),
|
||||
('def x(*): pass', '3.5'),
|
||||
('async def foo():\n def nofoo():[x async for x in []]', '3.6'),
|
||||
('[*[] for a in [1]]', '3.5'),
|
||||
]
|
||||
)
|
||||
def test_python_exception_matches_version(code, version):
|
||||
|
||||
Reference in New Issue
Block a user