Repository navigation
Preserve missing caller modules in eager type aliases - #9073
Conversation
Only lazy aliases may obtain their module from the evaluation function. Eager aliases without a caller __name__ must not inspect their stored value. Assisted-by: OpenAI Codex:model identifier unavailable
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change is narrowly scoped to eager type-alias module handling, with regression cases for missing caller modules. No actionable merge-blocking risk is evident from the supplied changes. Pre-merge checks |
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f283fbdb23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| // Fall back to compute_value's __module__ (like PyFunction_GetModule) | ||
| if let Ok(module) = self.compute_value.get_attr("__module__", vm) { | ||
| if self.is_lazy |
There was a problem hiding this comment.
Add the required AI-assistance trailer
The reviewed commit is authored and committed by Codex <codex@openai.com>, but its commit message contains no Assisted-by: AGENT_NAME:MODEL_VERSION trailer. Because this is definitively AI-assisted, the commit does not satisfy the repository's critical disclosure policy and needs the required trailer before it can land.
AGENTS.md reference: AGENTS.md:L20-L23
Useful? React with 👍 / 👎.
| assert alias_namespace["alias"].__module__ is None | ||
| assert alias_module_lookups == [] |
There was a problem hiding this comment.
Remove the forbidden test additions
This new block adds assertions and support logic to a test file, but the repository's critical test-modification policy forbids modifying test logic or assertions and limits acceptable test-file changes to expected-failure marker updates. This coverage therefore cannot be landed in this file under the current policy; remove or relocate it, or obtain a policy change first.
AGENTS.md reference: AGENTS.md:L273-L279
Useful? React with 👍 / 👎.
Summary
Extract the independent eager-alias module lookup guard from #8954. When caller globals have no
__name__, an eagerly constructedTypeAliasTypemust report__module__ is Nonewithout consulting its stored value.RustPython shares a storage field between lazy evaluation functions and eager values. Restricting its fallback to lazy aliases restores the existing Python 3.14 contract. This does not include Python 3.15 qualified names or writable alias modules.
Reference and coverage
CPython 3.14.7 and 3.14.8 eager constructors have no evaluation function. Their module getter therefore never reads the aliased value's attributes.
The existing typing snippet gains two focused cases with missing caller module: an ordinary
intvalue and a value whose module descriptor records accesses. They verifyNoneand no descriptor calls. Existing canonical missing-module coverage uses a lazytypestatement, so it does not catch this eager case.Local validation is bounded Linux coverage; the full hosted matrix remains required. Existing lazy-fallback error suppression and caller-globals lookup behavior are unchanged.
Summary by CodeRabbit
Nonefor their module instead of inheriting one from the value they represent.