Conversation
…ters The code was doing the same as the helper added in pythonGH-111957 but inline. That resulted in significantly more `.text` for most functions. Refactor the Arguemnt Clinic converters code to deduplicate a bit while keeping generated code close to original. On my Linux x64 box this reduces `.text` by ~6200 bytes in a clang release build (no PGO or LTO). Performance is flat. The helper was already exported for `_sqlite3`, update the comment that it is used in AC generated code as well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
eendebakpt
approved these changes
Sep 26, 2026
| @@ -0,0 +1,3 @@ | |||
| Argument Clinic now calls the internal function ``_PyUnicode_AsUTF8NoNUL()`` for | |||
| ``s`` and ``z`` converters instead of writing equivalent code inline to reduce | |||
| the generated ``.text`` segment. | |||
Contributor
There was a problem hiding this comment.
Suggested change
| the generated ``.text`` segment. | |
| the code size of generated argument parsers. |
(or even omit the news entry, as there are just implementation details)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
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
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.
The code was doing the same as the helper added in GH-111957 but inline. That resulted in significantly more
.textfor most functions. Refactor the Argument Clinic converters code to deduplicate a bit while keeping generated code close to original.On my Linux x64 box this reduces
.textby ~6200 bytes in a clang release build (no PGO or LTO). Performance is flat.The helper was already exported for
_sqlite3, update the comment that it is used in AC generated code as well.cc: @eendebakpt , @methane . Found this while working on moving
strto Argument Clinic generated code. The call + local rather than pointer to stack member, particularly when-fstack-protector-strongis set as some distros do, gets a lot shorter.