Title: Argument Clinic name conflict
Type: enhancement Stage:
Components: Argument Clinic Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, larry, pablogsal
Priority: low Keywords:

Created on 2020-02-24 17:30 by BTaskaya, last changed 2020-02-24 20:07 by BTaskaya.

Messages (2)
msg362599 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2020-02-24 17:30
Argument clinic uses some extra variables (like args, or noptargs, nargs etc.) for parsing. But there is a catch about these names, the generated code becomes wrong if there are any usages of them inside the signature. Encountered with this problem while working on *args support (in issue 20291). 

The possible solution is prefixing every argument in the parser with __clinic_ (__clinic_{var}) for preventing any kind of conflict. I'll draft a PR for this issue.
msg362602 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2020-02-24 20:07
After preparing the patch and transforming all arguments with a __clinic_ prefix, I saw there are some actions that are taken by relying on the parser code. An example;

In that case, self was already replaced with __clinic_self so that code doesn't work. IMHO there should be an identifier to distinguish these cases like; <self>->co_argc etc. When we see such defaults we can just replace them with the prefixed version.
Date User Action Args
2020-02-24 20:07:45BTaskayasetmessages: + msg362602
2020-02-24 17:30:10BTaskayacreate