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 — gh-113317: AC converter: Use add_include() in bad_argument() by vstinner · Pull Request #114324 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jan 19, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Rename also the 'clinic' global variable to 'global_clinic'.

  • Issue: Argument Clinic: split out global stateless helpers and constants from clinic.py #113317

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner requested review from AlexWaygood and erlend-aasland as code owners January 19, 2024 17:05
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 19, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 19, 2024
Argument Clinic: split out global stateless helpers and constants from clinic.py #113317
Closed
@vstinner vstinner added the skip news label Jan 19, 2024
@vstinner vstinner mentioned this pull request Jan 19, 2024
gh-113317: Pass clinic to AC parse_arg() methods #114319
Closed
@vstinner

vstinner commented Jan 19, 2024

Copy link
Copy Markdown
Member Author

Ah, my simple CConverter.add_include() implementation reached its limits:

  File "/home/runner/work/cpython/cpython/./Tools/clinic/clinic.py", line 3266, in bad_argument
    self.add_include('pycore_modsupport.h', '_PyArg_BadArgument()')
  File "/home/runner/work/cpython/cpython/./Tools/clinic/clinic.py", line 3339, in add_include
    raise ValueError("a converter only supports a single include")
ValueError: a converter only supports a single include
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland reviewed Jan 19, 2024
View reviewed changes
Comment thread Tools/clinic/clinic.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Jan 19, 2024

Copy link
Copy Markdown
Contributor

Ah, my simple CConverter.add_include() implementation reached its limits:

  File "/home/runner/work/cpython/cpython/./Tools/clinic/clinic.py", line 3266, in bad_argument
    self.add_include('pycore_modsupport.h', '_PyArg_BadArgument()')
  File "/home/runner/work/cpython/cpython/./Tools/clinic/clinic.py", line 3339, in add_include
    raise ValueError("a converter only supports a single include")
ValueError: a converter only supports a single include

Yeah, I suspected that :) Well, it should be straight forward to support multiple includes in converters; we could extract the nice "condition" logic you added for Clinic.add_include and reuse that for CConverter.add_include.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Jan 19, 2024

Copy link
Copy Markdown
Contributor

Also, I think the clinic global renaming should be kept out; this PR is likely to grow a little bit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
pythongh-113317: AC converter: Use add_include() in bad_argument()
5dff970
* Rename the 'clinic' global variable to 'global_clinic'.
* Make CConverter.add_include() smarter. Don't fail when adding
  exactly the same include twice.
* Copy converters includes later in output_templates().
@vstinner
vstinner force-pushed the ac_add_include branch from b151101 to 5dff970 Compare January 19, 2024 17:37
@vstinner

vstinner commented Jan 19, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Sorry, I should have run tests locally, or mark this PR as a draft. I didn't expect so many back and forth.

All issues should now be fixed (let's see what the CI says).

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland reviewed Jan 19, 2024
View reviewed changes
Comment thread Tools/clinic/clinic.py
# added late
for converter in converters:
include = converter.include
if include is not None:

@erlend-aasland erlend-aasland Jan 19, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that can be made an assert.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Jan 20, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all converters need a special include. Do you mean that include variable is never None?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@erlend-aasland erlend-aasland mentioned this pull request Jan 19, 2024
gh-113317: Don't use global clinic instance in bad_argument() #114330
Merged
@vstinner

vstinner commented Jan 30, 2024

Copy link
Copy Markdown
Member Author

commit e14930f was merged instead, I close my PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Jan 30, 2024
@vstinner
vstinner deleted the ac_add_include branch January 30, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@erlend-aasland erlend-aasland erlend-aasland left review comments
@AlexWaygood AlexWaygood Awaiting requested review from AlexWaygood

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@vstinner @erlend-aasland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — 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.