Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
erlend-aasland opened this issue Jun 29, 2022 · 1 comment · Fixed by #94431
Closed

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

erlend-aasland opened this issue Jun 29, 2022 · 1 comment · Fixed by #94431
Labels
topic-argument-clinic type-feature A feature request or enhancement

Comments

@erlend-aasland
Copy link
Contributor

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

@erlend-aasland erlend-aasland added type-feature A feature request or enhancement topic-argument-clinic labels Jun 29, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jun 29, 2022
erlend-aasland added a commit that referenced this issue Jul 7, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 7, 2022
…tom C names in Argument Clinic (pythonGH-94431)

(cherry picked from commit 8bbd70b)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 7, 2022
…tom C names in Argument Clinic (pythonGH-94431).

(cherry picked from commit 8bbd70b)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
erlend-aasland added a commit that referenced this issue Jul 7, 2022
…names in AC (GH-94431) (#94649)

(cherry picked from commit 8bbd70b)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
erlend-aasland added a commit that referenced this issue Jul 7, 2022
…names in AC (GH-94431) (#94650)

(cherry picked from commit 8bbd70b)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-argument-clinic type-feature A feature request or enhancement
Projects
None yet
1 participant