New submission from Joshua Oreman <orem...@gmail.com>:

On Python 3.9.0 with the new PEG parser, the following statement produces a 
SyntaxError:

with contextlib.nullcontext(range(1, 5)) as (first, *rest, last):
    print(first, rest, last)

On 3.8.x, or 3.9.0 with -X oldparser, it succeeds and prints "1 [2, 3] 4" as 
expected.

As I understand it, the thing after 'as' is an assignment target and should 
accept anything that can go on the LHS of an equals sign.

----------
components: Interpreter Core
messages: 378305
nosy: Joshua Oreman
priority: normal
severity: normal
status: open
title: PEG parser doesn't accept extended unpacking in with statement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to