Skip to content

gh-116751: Inline _PyArg_CheckPositional() in Argument Clinic #116753

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

Closed
wants to merge 2 commits into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 13, 2024

  • Compute "at least", "at most" and plural at build time (in Argument Clinic), rather than at runtime.
  • Don't format the function name in the format string to reduce the Python executable size, C compilers merge same format strings.
  • Make the generated code compatible with the limited C API.
  • Only clinic.py was modified manually, other changes are generated code.

* Compute "at least", "at most" and plural at build time (in Argument
  Clinic), rather than at runtime.
* Don't format the function name in the format string to reduce the
  Python executable size, C compilers merge same format strings.
* Make the generated code compatible with the limited C API.
* Only clinic.py was modified manually, other changes are generated
  code.
@vstinner vstinner force-pushed the clinic_inline_check_positional branch from 6ac82d8 to f8097eb Compare March 13, 2024 18:59
@vstinner
Copy link
Member Author

@serhiy-storchaka: Would you mind to review this change?

@vstinner
Copy link
Member Author

See also PR #116736

@brettcannon brettcannon removed their request for review March 13, 2024 19:21
@rhettinger rhettinger removed their request for review March 13, 2024 20:22
@serhiy-storchaka
Copy link
Member

Why not simply use the limited_capi code?

@serhiy-storchaka serhiy-storchaka removed request for corona10, ethanfurman and a team March 13, 2024 20:46
@vstinner
Copy link
Member Author

Why not simply use the limited_capi code?

Would you mind to elaborate?

@serhiy-storchaka
Copy link
Member

Lines between if limited_capi: and else: just above the code that uses _PyArg_CheckPositional.

@vstinner
Copy link
Member Author

Lines between if limited_capi: and else: just above the code that uses _PyArg_CheckPositional.

Oh. Now I'm feeling stupid, I simply didn't see these lines...

For my current use case, I will simply use the limited C API code path. I prefer to leave the clinic.py code unchanged for now, so I just close my PR :-)

@vstinner vstinner closed this Mar 13, 2024
@vstinner vstinner deleted the clinic_inline_check_positional branch March 13, 2024 22:08
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.

2 participants