GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix __origname__ of frozen modules by youknowone · Pull Request #6613 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Dec 31, 2025 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions
Copilot AI and others added 4 commits December 31, 2025 18:15
@youknowone
Initial plan
7a37e62
@youknowone
Fix frozen module origname metadata
6af48b2
Co-authored-by: youknowone <[email protected]>
@youknowone
Fix clippy warning in frozen origname handling
873c7f2
Co-authored-by: youknowone <[email protected]>
@youknowone
reimpl origname
72f314d
@coderabbitai

coderabbitai Bot commented Dec 31, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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
  • 📝 Generate docstrings

📜 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone marked this pull request as ready for review December 31, 2025 12:12
@youknowone
youknowone merged commit 7c8df94 into RustPython:main Dec 31, 2025
12 of 13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone deleted the origname branch December 31, 2025 12:12
@coderabbitai coderabbitai Bot mentioned this pull request Feb 8, 2026
Fix test_import: import machinery, circular imports, and script shadowing #7034
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add proper __origname__ to frozen module

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowone
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.