-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-108494: Argument Clinic: fix option group for Limited C API #108574
Conversation
Use PyTuple_Size() instead of PyTuple_GET_SIZE().
Issue found while converting syslog to the limited C API. |
nargs = 'PyTuple_Size(args)' | ||
else: | ||
nargs = 'PyTuple_GET_SIZE(args)' | ||
add(f"switch ({nargs}) {{\n") |
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.
Style suggestion -- because of the f-strings needing the duplication of {
, perhaps just being explicit in both cases would be worth it?
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") |
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.
LGTM, other than @AA-Turner's style nit, which I agree with :)
Merged, thanks for reviews. I prefer to avoid repetition even if the f-string is just a little bit surprising. |
Use PyTuple_Size() instead of PyTuple_GET_SIZE().