GeezerVison is showing github.com — Fix __origname__ of frozen modules by youknowone · Pull Request #6613 · RustPython/RustPython
Conversation
youknowone
commented
Dec 31, 2025
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
close #6523
fix #4565
Summary by CodeRabbit
- Bug Fixes
- Fixed module origin name resolution for frozen module imports to correctly map internal module aliases to their canonical names.
✏️ Tip: You can customize this high-level summary in your review settings.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Dec 31, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Caution
Review failed
The pull request is closed.
📝 Walkthrough
Walkthrough
This pull request implements proper __origname__ metadata for frozen modules. A new public function resolve_frozen_alias maps internal frozen module alias names to their original counterparts, which is then used to correctly populate the __origname__ attribute during module initialization across the import and module systems.
Changes
| Cohort / File(s) |
Summary |
Alias Resolution Function crates/vm/src/vm/mod.rs |
Adds public resolve_frozen_alias(name: &str) -> &str function that maps internal frozen module aliases ("_frozen_importlib" → "importlib._bootstrap", "_frozen_importlib_external" → "importlib._bootstrap_external") to their original names; includes a test validating the alias resolution behavior (test appears duplicated in file). |
Import Flow Updates crates/vm/src/import.rs |
Reworks import_frozen to fetch frozen objects directly from vm.state.frozen and construct code objects via vm.ctx.new_code; applies resolve_frozen_alias to derive the correct __origname__ attribute value instead of using the internal module name directly. |
Frozen Module Resolution crates/vm/src/stdlib/imp.rs |
Exposes resolve_frozen_alias as a public re-export; updates find_frozen to resolve the origname via resolve_frozen_alias and convert the result to a Python string. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
🐰 With frozen modules once unnamed,
Now aliases resolve their shame!
origname shines bright and true,
Bootstrap paths shine right on through!
✨ Finishing touches
📜 Recent review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between d3afd46 and 72f314d.
📒 Files selected for processing (3)
crates/vm/src/import.rs
crates/vm/src/stdlib/imp.rs
crates/vm/src/vm/mod.rs
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
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.
Assignees
No one assigned
Milestone
No milestone
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.