Skip to content

Argument Clinic crashes with ValueError for an optional group before a var-positional parameter #158320

Description

@serhiy-storchaka
/*[clinic input]
module foo
foo.bar
    [
    a: int
    ]
    *args: tuple
[clinic start generated code]*/

fails with ValueError: required is empty but left is not, raised by permute_optional_groups(), instead of a ClinicError pointing at the offending line.

The opposite order, *args: tuple / [a: int], reports You cannot use optional groups ('[' and ']') unless all parameters are positional-only ('/'), but this is confusing because *args also only accepts positional arguments.

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions