This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: PEG parser doesn't accept extended unpacking in with statement
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.9
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, Joshua Oreman, benjamin.peterson, gvanrossum, miss-islington, pablogsal
Priority: normal Keywords: patch

Created on 2020-10-09 06:56 by Joshua Oreman, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22611 merged BTaskaya, 2020-10-09 08:00
PR 22612 merged BTaskaya, 2020-10-09 10:05
Messages (3)
msg378305 - (view) Author: Joshua Oreman (Joshua Oreman) Date: 2020-10-09 06:56
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.
msg378309 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-09 09:56
New changeset 48f305fd122080a9181cbda33bdb42ea36a0136f by Batuhan Taskaya in branch 'master':
bpo-41979: Accept star-unpacking on with-item targets (GH-22611)
msg378311 - (view) Author: miss-islington (miss-islington) Date: 2020-10-09 10:31
New changeset 42157b9eaa7f4de69a5f5f65d4403d70efa6a5c2 by Batuhan Taskaya in branch '3.9':
[3.9] bpo-41979: Accept star-unpacking on with-item targets (GH-22611) (GH-22612)
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86145
2020-10-09 10:31:15miss-islingtonsetnosy: + miss-islington
messages: + msg378311
2020-10-09 10:05:38BTaskayasetpull_requests: + pull_request21595
2020-10-09 09:58:18lys.nikolaousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-09 09:56:57pablogsalsetmessages: + msg378309
2020-10-09 08:00:59BTaskayasetkeywords: + patch
stage: patch review
pull_requests: + pull_request21594
2020-10-09 07:54:58BTaskayasetnosy: + BTaskaya
2020-10-09 07:23:26serhiy.storchakasetnosy: + gvanrossum, benjamin.peterson, pablogsal
2020-10-09 06:56:54Joshua Oremancreate