Skip to content

Incorrect grammar for function parameter list #156614

Closed

Description

@RazvanAM

Documentation

The same issue as in https://discuss.python.org/t/function-definition-grammar-is-wrong/56998/7.

The current grammar for parameter_list_starargs allows a function definition such as:

def f(*):
    ...

which is incorrect.

One solution is to make the [star_parameter] not optional in the first alternative, i.e.:

parameter_list_starargs: "*" `star_parameter` ("," `defparameter`)* ["," [`parameter_star_kwargs`]]

Thank you!

Linked PRs

Activity

  1. challenge456 commented on Aug 30, 2026

    @challenge456
    Contributor

    Hi @maintainers! I would like to work on this issue as my first contribution. Could you please assign it to me? Thank you!..
    I'm working on a fix for this and will open a PR shortly."

  2. added 3 commits that reference this issue on Aug 30, 2026
  3. added a commit that references this issue on Aug 30, 2026
  4. added a commit that references this issue on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions