Skip to content

AC: it is allowed to use * after vararg definition #110907

Description

@sobolevn

Bug report

Right now this code is allowed:

            /*[clinic input]
            my_test_func

                pos_arg: object
                *args: object
                *
                kw_arg: object
            [clinic start generated code]*/

The question is: why? We try to stick to the same syntax CPython has, so there's no need to allow a code like this. So, we should raise something like: 'my_test_func' uses '*' more than once.

Proper way:

            /*[clinic input]
            my_test_func

                pos_arg: object
                *args: object
                kw_arg: object
            [clinic start generated code]*/

One more important thing: we also have cases like * [from ...]:

/*[clinic input]
depr_star_pos2_len1_with_vararg
    a: object
    *vararg: object
    * [from 3.14]
    b: object
[clinic start generated code]*/

But, this needs additional discussion which we should do in a separate issue.
This one is just about the double * bug.

For now, I do not touch this branch of code.

Refs #110782
CC @JelleZijlstra

Linked PRs

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions