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

Make Argument Clinic to generate PEP 7 conforming code #70493

Closed
serhiy-storchaka opened this issue Feb 8, 2016 · 8 comments
Closed

Make Argument Clinic to generate PEP 7 conforming code #70493

serhiy-storchaka opened this issue Feb 8, 2016 · 8 comments
Assignees
Labels
topic-argument-clinic type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 26305
Nosy @brettcannon, @larryhastings, @meadori, @vadmium, @serhiy-storchaka
Files
  • clinic_pep7_braces.patch
  • clinic_pep7_braces2.patch
  • clinic_escape_braces.patch: Backported to 3.5 braces escaping
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-06-09.13:18:07.021>
    created_at = <Date 2016-02-08.11:08:31.491>
    labels = ['type-feature', 'expert-argument-clinic']
    title = 'Make Argument Clinic to generate PEP 7 conforming code'
    updated_at = <Date 2016-06-09.13:18:07.020>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2016-06-09.13:18:07.020>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-06-09.13:18:07.021>
    closer = 'serhiy.storchaka'
    components = ['Demos and Tools', 'Argument Clinic']
    creation = <Date 2016-02-08.11:08:31.491>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['41849', '42673', '42679']
    hgrepos = []
    issue_num = 26305
    keywords = ['patch']
    message_count = 8.0
    messages = ['259836', '259837', '264597', '264598', '264603', '264628', '264632', '268024']
    nosy_count = 6.0
    nosy_names = ['brett.cannon', 'larry', 'meador.inge', 'python-dev', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26305'
    versions = ['Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    Proposed patch makes Argument Clinic to generate C code with curly braces as strongly preferred by PEP-7.

    @serhiy-storchaka serhiy-storchaka added type-feature A feature request or enhancement topic-argument-clinic labels Feb 8, 2016
    @vadmium
    Copy link
    Member

    vadmium commented Feb 8, 2016

    FWIW I agree with this change. I left one review comment. I presume the important stuff is just in Tools/clinic/clinic.py and the other changes are all generated code.

    @serhiy-storchaka
    Copy link
    Member Author

    The only thing that disturbs me is that some templates need duplicating braces, and others need quadrupling braces.

    @meadori
    Copy link
    Member

    meadori commented May 1, 2016

    LGTM. I agree that the extra braces are a little gross, but nothing immediately comes to mind as how to make that better.

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @larryhastings
    Copy link
    Contributor

    I'm not excited by this new addition to PEP-7, so I'm excusing myself from this issue.

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka self-assigned this Jun 9, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 9, 2016

    New changeset eeb742d8bf9c by Serhiy Storchaka in branch '3.5':
    Issue bpo-26305: Argument Clinic now escapes braces. No need to double them.
    https://hg.python.org/cpython/rev/eeb742d8bf9c

    New changeset d983c313b8f1 by Serhiy Storchaka in branch 'default':
    Issue bpo-26305: Argument Clinic now escapes braces. No need to double them.
    https://hg.python.org/cpython/rev/d983c313b8f1

    New changeset 2d7dcd8cf928 by Serhiy Storchaka in branch 'default':
    Issue bpo-26305: Argument Clinic now uses braces in C code as required by PEP-7.
    https://hg.python.org/cpython/rev/2d7dcd8cf928

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    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
    Development

    No branches or pull requests

    4 participants