GeezerVison is showing github.com — gh-157407: Reduce code size of ast and unicodeobject by methane · Pull Request #157393 · python/cpython
Conversation
methane
commented
Sep 13, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
This pull request refactors and optimizes the initialization and cleanup code for AST annotations and global static strings, focusing on reducing .text segment size.
This change reduces the size of Python's .text segment by approximately 1%, or about 60 KiB.
The main changes involve switching to offset-based iteration for both AST type cleanup and string initialization, and consolidating annotation logic to avoid code duplication.
Disclosure of the use of AI:
- This change was selected and refined by me from a set of code-size reduction changes generated by Codex.
- The description above was edited by me based on Copilot's "Generate Summary."
- This text was translated into English by ChatGPT from the Japanese text I wrote.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
eendebakpt reacted with eyes emoji
|
Can you create an issue for such changes please? just for tracking purposes
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
methane
changed the title
reduce .text size
gh-157407: Reduce code size of ast and unicodeobject
Sep 13, 2026
|
This pr reduces:
add_ast_annotations: 48K bytes
_PyAST_Fini : 13K bytes
_PyUnicode_InitGlobalObjects : 10K bytes
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
methane
added a commit
that referenced
this pull request
Sep 24, 2026
`&PyUnicode_Type` cannot be determined at compile time on Windows.
Caused by #157393.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|