FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-108494: Argument Clinic: fix option group for Limited C API by vstinner · Pull Request #108574 · python/cpython · GitHub

Repository navigation

gh-108494: Argument Clinic: fix option group for Limited C API - #108574

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:ac_limited_option_group
Aug 29, 2023
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:ac_limited_option_group

Conversation

vstinner commented Aug 28, 2023 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Use PyTuple_Size() instead of PyTuple_GET_SIZE().

Use PyTuple_Size() instead of PyTuple_GET_SIZE().

Copy link
Copy Markdown
Member Author

Issue found while converting syslog to the limited C API.

Comment thread Tools/clinic/clinic.py Outdated
Comment thread Tools/clinic/clinic.py
Comment on lines +1718 to +1721
nargs = 'PyTuple_Size(args)'
else:
nargs = 'PyTuple_GET_SIZE(args)'
add(f"switch ({nargs}) {{\n")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Style suggestion -- because of the f-strings needing the duplication of {, perhaps just being explicit in both cases would be worth it?

Suggested change
nargs = 'PyTuple_Size(args)'
else:
nargs = 'PyTuple_GET_SIZE(args)'
add(f"switch ({nargs}) {{\n")
add("switch (PyTuple_Size(args)) {\n")
else:
add("switch (PyTuple_GET_SIZE(args)) {\n")

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, other than @AA-Turner's style nit, which I agree with :)

vstinner merged commit e675e51 into python:main Aug 29, 2023
vstinner deleted the ac_limited_option_group branch August 29, 2023 11:33

Copy link
Copy Markdown
Member Author

Merged, thanks for reviews. I prefer to avoid repetition even if the f-string is just a little bit surprising.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL