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.

Title: Make Argument Clinic to generate PEP 7 conforming code
Type: enhancement Stage: resolved
Components: Argument Clinic, Demos and Tools Versions: Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, larry, martin.panter, meador.inge, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-02-08 11:08 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
clinic_pep7_braces.patch serhiy.storchaka, 2016-02-08 11:07 review
clinic_pep7_braces2.patch serhiy.storchaka, 2016-05-01 17:37 review
clinic_escape_braces.patch serhiy.storchaka, 2016-05-02 09:08 Backported to 3.5 braces escaping review
Messages (8)
msg259836 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-08 11:07
Proposed patch makes Argument Clinic to generate C code with curly braces as strongly preferred by PEP 7.
msg259837 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-02-08 11:33
FWIW I agree with this change. I left one review comment. I presume the important stuff is just in Tools/clinic/ and the other changes are all generated code.
msg264597 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-01 13:59
The only thing that disturbs me is that some templates need duplicating braces, and others need quadrupling braces.
msg264598 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2016-05-01 14:24
LGTM.  I agree that the extra braces are a little gross, but nothing immediately comes to mind as how to make that better.
msg264603 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-01 17:37
The problem was that I didn't know wherever all braces repeated correct times. Actually they were not used correctly in NoneType_return_converter, but since this converter is not used in current sources, this error left unnoticed.

New patch escapes generated strings that can contain braces before substituting them in the template for format(). This allows to decrease the braces repetition number to minimal value. Now there is no need to quadruple them.
msg264628 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2016-05-02 06:40
I'm not excited by this new addition to PEP 7, so I'm excusing myself from this issue.
msg264632 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-02 09:08
Here is a patch for 3.5 that allows to not repeat braces too much. This will help to backport new fixes to 3.5.
msg268024 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-09 13:17
New changeset eeb742d8bf9c by Serhiy Storchaka in branch '3.5':
Issue #26305: Argument Clinic now escapes braces. No need to double them.

New changeset d983c313b8f1 by Serhiy Storchaka in branch 'default':
Issue #26305: Argument Clinic now escapes braces. No need to double them.

New changeset 2d7dcd8cf928 by Serhiy Storchaka in branch 'default':
Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7.
Date User Action Args
2022-04-11 14:58:27adminsetgithub: 70493
2016-06-09 13:18:07serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-06-09 13:17:24python-devsetnosy: + python-dev
messages: + msg268024
2016-06-09 12:28:50serhiy.storchakasetassignee: serhiy.storchaka
2016-05-02 09:08:51serhiy.storchakasetfiles: + clinic_escape_braces.patch

messages: + msg264632
2016-05-02 06:40:58larrysetnosy: brett.cannon, larry, meador.inge, martin.panter, serhiy.storchaka
messages: + msg264628
2016-05-01 18:49:00serhiy.storchakalinkissue23867 dependencies
2016-05-01 17:38:13serhiy.storchakasetfiles: + clinic_pep7_braces2.patch

messages: + msg264603
2016-05-01 14:24:46meador.ingesetnosy: + meador.inge
messages: + msg264598
2016-05-01 13:59:22serhiy.storchakasetmessages: + msg264597
2016-02-08 11:33:32martin.pantersetnosy: + martin.panter
messages: + msg259837
2016-02-08 11:08:58serhiy.storchakasetcomponents: + Argument Clinic
2016-02-08 11:08:31serhiy.storchakacreate