Skip to content

AC: Params named module with custom C names are rejected #94430

Description

@erlend-aasland

Feature or enhancement

Currently, Argument Clinic will not allow parameters named module, even though they've got a custom C name. For example, this clinic input is rejected:

/*[clinic input]
mod.func

    module as mod: object

[clinic start generated code]*/

AC complains with "You can't have two parameters named 'module'!", even though there is no naming collision on the C level. This issue prevents AC conversion of some functions and methods in the code base, for example warn_explicit() in Python/_warnings.c. A workaround is to provide a custom name to the self converter, however I view that as a hack; it adds unneeded clinic code.

Hack/workaround
/*[clinic input]
mod.func

    _module: self(type="PyObject *")
    module as mod: object

[clinic start generated code]*/

Pitch

The fix is easy (its almost a one-liner), and it unlocks more AC conversions, without requiring unneeded hacks.

Patch

diff.txt

Metadata

Metadata

Assignees

No one assigned

    Fields

    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