Skip to content

Use globals module names for eval and exec warnings - #9294

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:split/eval-exec-warning-module
Oct 22, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:split/eval-exec-warning-module

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Continues the Python 3.15 upgrade decomposition from #8954.

Pass globals['__name__'] through the existing compilation-warning path for string inputs to eval() and exec(), matching CPython's _PyRun_String behavior.

This lets warning filters match the supplied module instead of incorrectly falling back to <string>. A missing name still uses filename fallback; an explicitly supplied None retains CPython's warning-suppression behavior. Typed compile/symtable/interactive entrypoints remain intact, including compile(module=...) validation.

The behavior change is limited to two native files. It does not change warning ordering, numeric-warning metadata, parser recovery, or existing filename/callback handling. This does not incorporate the separate unmerged work in #9282.

A test-marker-only follow-up removes the now-stale expectedFailure on BuiltinTest.test_exec_filter_syntax_warnings_by_module using the canonical scripts/update_lib migrate workflow. The complete canonical method body, fixture and every other local adaptation remain unchanged. Hosted RustPython CI on the initial head reported that method as an unexpected success both initially and on its own rerun; that old run remains failed, not green.

Validation

Tested native base: ad8bd18f341445761fc57b1080db6e6e8e0e10e7. The following native/local results were established before the test-marker-only follow-up; native source is byte-for-byte unchanged.

  • Fresh source-bound default-features + capi CLI builds for baseline and candidate, with actual native compilation inputs verified, including host_env/CAPI.
  • Eleven bounded external observations against CPython 3.15.0, using canonical source contract d220409a13b77de7a6c30abe16ea90db01528edc: baseline 5/11, candidate and oracle 11/11. All candidate observation records match the oracle, including captured warning messages.
  • Six eval/exec differences fixed: named-module filtering, rejection of incorrect filename fallback, and explicit-None suppression. Missing-name fallback and three compile-only controls remain unchanged.
  • VM checks with and without threading, VM test-target compilation check, strict Clippy for VM all-targets with threading, and normal changed-file hooks passed.

The observations use fresh owned dictionaries and fixed literal expressions/assignments, in independent -B processes with 120-second timeouts and 1 GiB address-space limits. They are external finite observations, not execution of canonical test modules, the ZIP fixture, or the full suite. The CAPI-linked CLI builds do not constitute CAPI runtime validation; Rust test targets were checked, not executed.

The updater-generated follow-up has passed source-identity checks and normal changed-file hooks. It does not add a native build or a full local suite run. New-head hosted CI is pending.

Prepared and validated with AI assistance.

Forward the supplied scope module through compilation warnings while
preserving typed compile entrypoints and missing-name filename fallback.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between ad8bd18 and 236e338.

⛔ Files ignored due to path filters: 1
  • Lib/test/test_builtin.py is excluded by !Lib/**
📒 Files selected for processing: 2
  • crates/vm/src/stdlib/builtins.rs
  • crates/vm/src/vm/compile.rs
+---------------------------------------------------------------------------------------------------+
| Little bunny Foo Foo, hopping through the code, picking up the bugs and bopping them on the head. |
+---------------------------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Regenerate test_builtin through update_lib with all other adaptations
preserved after hosted CI reports the canonical method succeeds.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] test: cpython/Lib/test/test_builtin.py (TODO: 2)

dependencies:

dependent tests: (no tests depend on builtin)

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T09:15:09.610008Z 236e338 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@youknowone
youknowone merged commit e102ccd into RustPython:main Oct 22, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants