Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEG parser doesn't accept extended unpacking in with statement #86145

Closed
oremanj mannequin opened this issue Oct 9, 2020 · 3 comments
Closed

PEG parser doesn't accept extended unpacking in with statement #86145

oremanj mannequin opened this issue Oct 9, 2020 · 3 comments
Labels
3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@oremanj
Copy link
Mannequin

oremanj mannequin commented Oct 9, 2020

BPO 41979
Nosy @gvanrossum, @benjaminp, @pablogsal, @miss-islington, @isidentical, @oremanj
PRs
  • bpo-41979: Accept star-unpacking on with-item targets #22611
  • [3.9] bpo-41979: Accept star-unpacking on with-item targets (GH-22611) #22612
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-10-09.09:58:18.249>
    created_at = <Date 2020-10-09.06:56:54.326>
    labels = ['interpreter-core', '3.9']
    title = "PEG parser doesn't accept extended unpacking in with statement"
    updated_at = <Date 2020-10-09.10:31:15.580>
    user = 'https://github.com/oremanj'

    bugs.python.org fields:

    activity = <Date 2020-10-09.10:31:15.580>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-09.09:58:18.249>
    closer = 'lys.nikolaou'
    components = ['Interpreter Core']
    creation = <Date 2020-10-09.06:56:54.326>
    creator = 'Joshua Oreman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41979
    keywords = ['patch']
    message_count = 3.0
    messages = ['378305', '378309', '378311']
    nosy_count = 6.0
    nosy_names = ['gvanrossum', 'benjamin.peterson', 'pablogsal', 'miss-islington', 'BTaskaya', 'Joshua Oreman']
    pr_nums = ['22611', '22612']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41979'
    versions = ['Python 3.9']

    @oremanj
    Copy link
    Mannequin Author

    oremanj mannequin commented Oct 9, 2020

    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.

    @oremanj oremanj mannequin added 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Oct 9, 2020
    @pablogsal
    Copy link
    Member

    New changeset 48f305f by Batuhan Taskaya in branch 'master':
    bpo-41979: Accept star-unpacking on with-item targets (GH-22611)
    48f305f

    @miss-islington
    Copy link
    Contributor

    New changeset 42157b9 by Batuhan Taskaya in branch '3.9':
    [3.9] bpo-41979: Accept star-unpacking on with-item targets (GH-22611) (GH-22612)
    42157b9

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants