GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Argument Clinic: multiple macro definition · Issue #67688 · python/cpython

Argument Clinic: multiple macro definition #67688

New issue
Copy link
New issue
Copy link
Closed
Closed
Argument Clinic: multiple macro definition#67688
Copy link
Assignees
larryhastings
Labels
buildThe build process and cross-buildThe build process and cross-buildtopic-argument-clinictype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Feb 22, 2015
Issue body actions
BPO 23500
Nosy @larryhastings, @serhiy-storchaka
Files
  • sample.c
  • clinic_append.patch
  • sample.c: Fixed sample file
  • larry.ac_multiple_macro_definitions.diff.1.txt
  • larry.ac_multiple_macro_definitions.diff.2.txt: Diff after running "make clinic" with this patch
  • clinic_append_2.patch
  • sample.c
  • larry.ac_multiple_macro_definitions.diff.3.txt: Another approach for cleaning up the multiple macros problem.
  • larry.ac_multiple_macro_definitions.diff.4.txt
  • larry.ac_multiple_macro_definitions.diff.5.txt
  • 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/larryhastings'
    closed_at = <Date 2015-04-03.20:35:59.511>
    created_at = <Date 2015-02-22.10:37:42.845>
    labels = ['type-bug', 'expert-argument-clinic', 'build']
    title = 'Argument Clinic: multiple macro definition'
    updated_at = <Date 2015-04-03.20:35:59.509>
    user = 'https://github.com/serhiy-storchaka'
    

    bugs.python.org fields:

    activity = <Date 2015-04-03.20:35:59.509>
    actor = 'larry'
    assignee = 'larry'
    closed = True
    closed_date = <Date 2015-04-03.20:35:59.511>
    closer = 'larry'
    components = ['Build', 'Demos and Tools', 'Argument Clinic']
    creation = <Date 2015-02-22.10:37:42.845>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['38205', '38328', '38329', '38491', '38492', '38494', '38495', '38538', '38821', '38822']
    hgrepos = []
    issue_num = 23500
    keywords = ['patch', 'needs review']
    message_count = 27.0
    messages = ['236403', '236405', '236407', '237183', '237185', '237192', '237201', '238076', '238119', '238120', '238122', '238126', '238128', '238384', '238420', '239576', '239596', '240008', '240009', '240010', '240012', '240016', '240028', '240029', '240030', '240031', '240035']
    nosy_count = 3.0
    nosy_names = ['larry', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23500'
    versions = ['Python 3.5']
    

    Activity

    Next
    1. serhiy-storchaka commented on Feb 22, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Feb 22, 2015
      MemberAuthor
      More actions

      Argument Clinic generates multiple definitions in non-block mode for functions with alternating signature. See example file. If FOO is not defines, SPAM_METHODDEF is defined twice.

      First time in:

      #ifndef SPAM_METHODDEF
          #define SPAM_METHODDEF
      #endif /* !defined(SPAM_METHODDEF) */
      

      Second time in:

      #if !defined(FOO)
      ...
      #define SPAM_METHODDEF    \
      
    2. serhiy-storchaka
      added
      buildThe build process and cross-buildThe build process and cross-build
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Feb 22, 2015
    3. larryhastings commented on Feb 22, 2015

      @larryhastings
      larryhastings
      on Feb 22, 2015
      Contributor
      More actions

      Can you give me a test case?

    4. serhiy-storchaka commented on Feb 22, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Feb 22, 2015
      MemberAuthor
      More actions

      Oh, sorry. Here is a sample. Other sample see in bpo-23501.

    5. serhiy-storchaka
      added
      topic-argument-clinic
      on Feb 25, 2015
    6. serhiy-storchaka commented on Mar 4, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Mar 4, 2015
      MemberAuthor
      More actions

      Here is a patch which moves all methoddef_ifndef to the end of the buffer or file, so they are not conflicts with other definitions.

    7. serhiy-storchaka commented on Mar 4, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Mar 4, 2015
      MemberAuthor
      More actions

      Here is a sample file generated by fixed clinic.py.

    8. larryhastings commented on Mar 4, 2015

      @larryhastings
      larryhastings
      on Mar 4, 2015
      Contributor
      More actions

      In your sample output we still get two #ifndef SPAM_METHODDEF stanzas. Wouldn't it be better to only have one?

      Maybe Clinic needs to be smarter about generating those anyway. Let me think about it.

    9. serhiy-storchaka commented on Mar 4, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Mar 4, 2015
      MemberAuthor
      More actions

      Actually in this sample output no one #ifndef SPAM_METHODDEF stanza is needed, because SPAM_METHODDEF is defined in any case.

    10. serhiy-storchaka commented on Mar 14, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Mar 14, 2015
      MemberAuthor
      More actions

      May be first commit this non-perfect solution? Generated code is correct, it is just not optimal. This issue is a dependency of bpo-23501, that is a dependency of bpo-23492, that is a dependency of my patch for optimizing argument parsing in 1-argument functions.

    11. larryhastings commented on Mar 15, 2015

      @larryhastings
      larryhastings
      on Mar 15, 2015
      Contributor
      More actions

      How about this approach? Only ever emit the #ifndef stanza once per symbol.

    12. larryhastings commented on Mar 15, 2015

      @larryhastings
      larryhastings
      on Mar 15, 2015
      Contributor
      More actions

      (see larry.ac_multiple_macro_definitions.diff.1.txt posted above)

    13. larryhastings commented on Mar 15, 2015

      @larryhastings
      larryhastings
      on Mar 15, 2015
      Contributor
      More actions

      Oops, I should have run "make clinic", so you could see all the changes that result from this patch.

    14. serhiy-storchaka commented on Mar 15, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Mar 15, 2015
      MemberAuthor
      More actions

      It doesn't fix the issue, because the #ifndef stanza is emitted before second definition. Try to run clinic.py with your patch on sample.c. But may be this idea can be used with my patch.

    15. 6 remaining items

    16. serhiy-storchaka commented on Apr 3, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 3, 2015
      MemberAuthor
      More actions

      Looks as you didn't notice my comments on Rietveld.

    17. larryhastings commented on Apr 3, 2015

      @larryhastings
      larryhastings
      on Apr 3, 2015
      Contributor
      More actions

      I did, I just didn't respond. I'll do that now.

    18. larryhastings commented on Apr 3, 2015

      @larryhastings
      larryhastings
      on Apr 3, 2015
      Contributor
      More actions

      Updated patch, removed all references to two-pass. Also realized I needed to make the default behavior for methoddef_ifndef go to the end. And, finally, I forgot to merge the "only print each #ifndef block once" code I wrote before when I redid the patch, so that's in now.

    19. serhiy-storchaka commented on Apr 3, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 3, 2015
      MemberAuthor
      More actions

      larry.ac_multiple_macro_definitions.diff.5.txt LGTM.

    20. serhiy-storchaka
      assigned
      larryhastings
      on Apr 3, 2015
    21. python-dev commented on Apr 3, 2015

      @python-dev
      python-devmannequin
      on Apr 3, 2015
      Mannequin
      More actions

      New changeset 25eef0ecb9c1 by Larry Hastings in branch 'default':
      Issue bpo-23500: Argument Clinic is now smarter about generating the "#ifndef"
      https://hg.python.org/cpython/rev/25eef0ecb9c1

    22. larryhastings commented on Apr 3, 2015

      @larryhastings
      larryhastings
      on Apr 3, 2015
      Contributor
      More actions

      Does this really need a backport to 3.4?

    23. serhiy-storchaka commented on Apr 3, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 3, 2015
      MemberAuthor
      More actions

      I think this is not needed.

    24. serhiy-storchaka commented on Apr 3, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 3, 2015
      MemberAuthor
      More actions

      Thank you Larry.

    25. larryhastings commented on Apr 3, 2015

      @larryhastings
      larryhastings
      on Apr 3, 2015
      Contributor
      More actions

      Removing 3.4 from the version list as I close the bug, then. If we decide we need it backported please reopen (or create a new bug, either is fine).

    26. larryhastings
      closed this as completedon Apr 3, 2015
    27. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    28. erlend-aasland
      added 3 commits that reference this issue on May 3, 2023

      pythongh-104146: Remove unused 'second_pass_replacements' from clinic.py

      9768f7f

      pythongh-104146: Remove unused 'second_pass_replacements' from clinic.py

      396125f

      gh-104146: Remove unused 'second_pass_replacements' from clinic.py (#…

      9885677
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @larryhastings
      larryhastings

    Labels

    buildThe build process and cross-buildThe build process and cross-buildtopic-argument-clinictype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.