Repository navigation
Support compile(module=...) across AST warning paths - #8947
youknowdot wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe ChangesCompile module argument and warning propagation
AST format-spec warning collection
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant PythonCaller
participant BuiltinsCompile
participant Compiler
participant WarningSystem
PythonCaller->>BuiltinsCompile: Call compile with optional module
BuiltinsCompile->>Compiler: Pass source and validated module
Compiler->>WarningSystem: Emit warning with module and source location
Merge Risk: ⚪ Minimal · up to This change adds Python 3.15's keyword-only 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Add Python 3.15 compile(module=...) warning filtering. Move format-spec diagnostics to a fallible, literal-aware AST boundary; preserve nested literal warnings while excluding raw text and comments, map function-type fragments to source locations, and suppress duplicate type-comment emissions with per-call tracking. Keep unrelated legacy warning-detection and exact diagnostic metadata gaps documented by differential probes. Add focused flag, source-location, exception, reentrancy, filtering and literal-boundary regression coverage. Assisted-by: Codex:model-version-unavailable
Convert the single-mode multiple statements error into the generic parse error type, and iterate f-string parts through FStringPartRef. Assisted-by: Claude Code:claude-opus-5-5
a86db27 to
3cc5388
Compare
Summary
Add Python 3.15's keyword-only
compile(module=...)argument for SyntaxWarning filtering, including AST-only compilation and type comments. This is an independent native prerequisite for the 3.15 importlib/bootstrap migration; the advertised Python version and bundled libraries remain unchanged.moduleas str or None, keep diagnostic filenames separate, and preserve the existing Rust compile APIs through wrappersThe implementation does not run a new whole-source warning scan before every AST parse or keep mutable warning context in VM-global/thread-local state.
Reference: CPython v3.15.0rc2, commit
435c9e5a798c99653e3ab64ce29baed0e4f3dfee. Its importlib source loader supplies this module context when compiling source.Validation
Independent branch at
a86db2711a26ece3781f39fea7b48c042f59bb3f:-m test test_compile test_ast test_warnings test_site test_support test_importlib test_pkgutil --timeout 180: all seven suites successful, 2,156 run and 152 skippedRemaining scope limits
This does not claim full compiler-warning parity. Existing missing warnings for ordinary AST-only literals and some ordinary-source/raw/template paths, and unrelated parser/traversal ordering, remain outside this change.
The shared diagnostic formatter also retains precise differences from CPython: three nested-template error cases point at the actual backslash rather than CPython's shifted position; three function-type cases append a newline to SyntaxError.text; one existing codegen case lacks end fields and differs in source text. These do not change module filtering, exception identity/type, valid-source acceptance, or duplicate suppression. They are recorded rather than hidden behind skips or CPython-specific caret adjustments.
AI assistance
OpenAI Codex assisted with implementation, CPython comparison, tests, review, and this description under maintainer direction. The runtime did not expose the exact model version. Results are automated Linux x86_64 verification; no additional human-use or untested-platform validation is claimed.
Summary by CodeRabbit
moduleargument tocompile(). Its value is included in compiler warning messages, while source filenames remain unchanged.modulenow raise aTypeError.