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

Argument Clinic incorretly translates #elif #84360

Closed
serhiy-storchaka opened this issue Apr 4, 2020 · 6 comments
Closed

Argument Clinic incorretly translates #elif #84360

serhiy-storchaka opened this issue Apr 4, 2020 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build topic-argument-clinic

Comments

@serhiy-storchaka
Copy link
Member

BPO 40179
Nosy @larryhastings, @serhiy-storchaka
PRs
  • bpo-40179: Fix translation of #elif in Argument Clinic #19364
  • bpo-40178: Convert the remaining os functions to Argument Clinic. #19360
  • [3.8] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364) #19583
  • [3.7] bpo-40179: Fix translation of GH-elif in Argument Clinic (GH-19364) #19584
  • 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 = None
    closed_at = <Date 2020-04-18.16:13:03.047>
    created_at = <Date 2020-04-04.16:26:41.655>
    labels = ['3.8', 'build', '3.7', 'expert-argument-clinic', '3.9']
    title = 'Argument Clinic incorretly translates #elif'
    updated_at = <Date 2020-04-18.16:13:03.047>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2020-04-18.16:13:03.047>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-18.16:13:03.047>
    closer = 'serhiy.storchaka'
    components = ['Build', 'Argument Clinic']
    creation = <Date 2020-04-04.16:26:41.655>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40179
    keywords = ['patch']
    message_count = 6.0
    messages = ['365769', '365772', '365790', '366721', '366723', '366724']
    nosy_count = 2.0
    nosy_names = ['larry', 'serhiy.storchaka']
    pr_nums = ['19364', '19360', '19583', '19584']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue40179'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @serhiy-storchaka
    Copy link
    Member Author

    It converts

        #if A
        ...
        #elif B
        ...
        #else
        ...
        #endif

    into

        #if A
        ...
        #endif /* A */
    
        #if B
        ...
        #endif /* B */
    
        #if !B
        ...
        #endif /* !B */

    The correct translation is:

        #if A
        ...
        #endif /* A */
    
        #if !A && B
        ...
        #endif /* !A && B */
    
        #if !A && !B
        ...
        #endif /* !A && !B */

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build topic-argument-clinic labels Apr 4, 2020
    @larryhastings
    Copy link
    Contributor

    Good catch, and thanks for submitting a patch too! I want to play with your patch a little before I just say "yes of course".

    @serhiy-storchaka
    Copy link
    Member Author

    See PR 19360 for real example.

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 12446e6 by Serhiy Storchaka in branch 'master':
    bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
    12446e6

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset bfda4db by Serhiy Storchaka in branch '3.8':
    [3.8] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364) (GH-19583)
    bfda4db

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 67ae454 by Serhiy Storchaka in branch '3.7':
    [3.7] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364) (GH-19584)
    67ae454

    @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
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build topic-argument-clinic
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants