Skip to content

Incorrect syntax error message for incorrect argument unpacking #110696

Closed
@thatbirdguythatuknownot

Description

Bug report

Bug description:

I don't think SyntaxError: iterable argument unpacking follows keyword argument unpacking should be present in a case like this (minimal reproducible example):

>>> func(t, *:)
  File "<stdin>", line 1
    func(t, *:)
         ^
SyntaxError: iterable argument unpacking follows keyword argument unpacking

So it seems like if * is followed by code that triggers a generic SyntaxError: invalid syntax error, the former error triggers and overshadows the generic error. This has somewhat made checking the error in the expression following that * a bit harder.
I have another question. func(a=5, *b) is apparently allowed but from the error func(**{'a': 7}, *b) isn't? I don't know what the PEP is for this so I'll try to search it up later.

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions