This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Argument Clinic: setting internal variable names for parsed arguments
Type: enhancement Stage: resolved
Components: Build, Demos and Tools Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Argument Clinic: rename arguments in generated C?
View: 20227
Assigned To: Nosy List: larry, taleinat, zach.ware
Priority: normal Keywords: patch

Created on 2014-01-21 11:28 by taleinat, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
clinic_allow_setting_c_variable_name.patch taleinat, 2014-01-21 12:09 review
Messages (3)
msg208641 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2014-01-21 11:28
It would be useful for conversion of existing function to be able to set the name of the C variable for arguments which is different than the Python argument name.

For example, not being able to do so makes converting bytes.translate much harder. In the existing code, the first argument is called 'table' in the docs but 'tableobj' in the code. Furthermore, a different variable named 'table' is used rather extensively in the function. If clinic could be told to name the C variable 'tableobj', then that would be that. Otherwise renaming two variables in the code is unaviodable.
msg208644 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2014-01-21 12:09
Attaching a straight-forward patch, adding an optional 'c_name' parameter to CConvertor. When given it is used for the name of the C variable. It is also used for the '_length' variable names (when used).

This works for my use case (bytes.translate). All existing clinic tests pass.

This patch doesn't include new tests. If this feature request and implementation approach are accepted, I'd be happy to add tests.
msg208699 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-01-21 20:30
This is a duplicate of issue20227; I'm adding you to the nosy of that one, Tal.
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64526
2014-01-21 20:30:57zach.waresetstatus: open -> closed

superseder: Argument Clinic: rename arguments in generated C?

nosy: + zach.ware
messages: + msg208699
resolution: duplicate
stage: resolved
2014-01-21 12:09:07taleinatsetfiles: + clinic_allow_setting_c_variable_name.patch

nosy: + larry
messages: + msg208644

keywords: + patch
2014-01-21 11:28:14taleinatcreate