Skip to content

Incorrect grammar for function parameter list #156614

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions