René's URL Explorer Experiment


Title: Support compile(module=...) across AST warning paths by youknowdot · Pull Request #8947 · RustPython/RustPython · GitHub

Open Graph Title: Support compile(module=...) across AST warning paths by youknowdot · Pull Request #8947 · RustPython/RustPython

X Title: Support compile(module=...) across AST warning paths by youknowdot · Pull Request #8947 · RustPython/RustPython

Description: This PR follows our AI policy 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. Validate module as str or None, keep diagnostic filenames separate, and preserve the existing Rust compile APIs through wrappers Route existing AST format-spec diagnostics through a fallible, explicit-context boundary over the validated AST before preprocessing Inspect literal spans so raw strings and comments do not become false SyntaxErrors, while nested nonraw warnings and distinct literals survive optimization Map function-type argument/return fragments back to original source locations Suppress duplicate TYPE_COMMENTS escape emissions using per-invocation offset tracking; warning callbacks can re-enter compile without sharing state Preserve arbitrary warning-handler exceptions; convert escalated SyntaxWarning through the existing SyntaxError formatter The 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: Release build with SQLite enabled, source-isolation checks, and the expanded native regression snippet pass The same snippet passes exact CPython 3.15.0rc2; its older-CPython comparison uses the existing version guard while RustPython always executes every assertion -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 skipped Independent 540-case differential corpus completed. Final membership cleanup produced byte-identical outputs to the reviewed candidate. 485 records match CPython exactly; 48 retain baseline detection/parser/traversal limitations and seven have the diagnostic differences below. All 180 optimization/folding controls match Full bounded snippet aggregate: 469 passed, 13 failed. The failures are the unchanged executor/stress set: ten AF_UNIX socket permission failures, two chown errno differences, and one CPython 3.14 GC/import timeout. No new snippet failures Workspace Rust tests: 1,345 passed, 18 ignored, no failures or warnings Separate C-API tests: 115 passed, 4 ignored; workspace and separate C-API all-targets Clippy both passed without warnings Normal configured commit hooks and diff checks pass Remaining 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. Python 3.15.0 final reference refresh (2026-10-09) The comparison target is now CPython v3.15.0 final, commit d220409a13b77de7a6c30abe16ea90db01528edc; the final importlib source loader supplies the module context. The upstream compile signature, module-context warning path, importlib source-loader caller, test_compile and test_warnings surfaces are unchanged from rc2. No native change is needed for this narrowly scoped contract. Adjacent parser and AST changes remain outside this PR's module-filtering scope. Fresh reference validation: the exact regression snippet at PR head 3cc5388b1e84a89dc42eef99dbfaf948afcd1d78 (extra_tests/snippets/builtin_compile_module.py) passed on exact CPython 3.15.0 final (exit 0; all assertions executed). This is a new CPython reference run only; the historical rc2 differential corpus, RustPython results and documented parity limits above remain unchanged. Hosted checks for that unchanged PR head were rechecked on this date: all reported checks are terminal success or skipped; no pending or failed checks were reported. 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 New Features Added an optional keyword-only module argument to compile(). Its value is included in compiler warning messages, while source filenames remain unchanged. Invalid escape warnings in format specifications are now reported during parsing. Bug Fixes Prevented duplicate invalid escape warnings across parsing and compilation. Invalid values for module now raise a TypeError.

Open Graph Description: This PR follows our AI policy Summary Add Python 3.15's keyword-only compile(module=...) argument for SyntaxWarning filtering, including AST-only compilation and type comments. This is an inde...

X Description: This PR follows our AI policy Summary Add Python 3.15's keyword-only compile(module=...) argument for SyntaxWarning filtering, including AST-only compilation and type comments. This is an ...

Opengraph URL: https://github.com/RustPython/RustPython/pull/8947

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4f3001fe-43aa-73f7-7dea-e75cdb36fc56
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCAF4:3E418A:121F5D5:17DBC80:6B01E691
html-safe-nonce8b737482cc1ff1c8a0f4045bf6d722eb5ddedd7d056f1433781cfcfbccdaa032
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUY0OjNFNDE4QToxMjFGNUQ1OjE3REJDODA6NkIwMUU2OTEiLCJ2aXNpdG9yX2lkIjoiMzQ3OTQxOTAyMTkzMjIyNjE5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace9f7fced984a07399a6c8a8c328064b4c4cf87a66757f8a9977862d5b39e81a3
hovercard-subject-tagpull_request:4718203915
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/8947/files
twitter:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
og:image:altThis PR follows our AI policy Summary Add Python 3.15's keyword-only compile(module=...) argument for SyntaxWarning filtering, including AST-only compilation and type comments. This is an inde...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/8947/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8947%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8947%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/8947/files
Reloadhttps://github.com/RustPython/RustPython/pull/8947/files
Reloadhttps://github.com/RustPython/RustPython/pull/8947/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
youknowdot:cpython-315-compile-modulehttps://github.com/youknowdot/RustPython/tree/cpython-315-compile-module
Conversation 1 https://github.com/RustPython/RustPython/pull/8947
Commits 2 https://github.com/RustPython/RustPython/pull/8947/commits
Checks 28 https://github.com/RustPython/RustPython/pull/8947/checks
Files changed https://github.com/RustPython/RustPython/pull/8947/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8947/files
Support compile(module=...) across AST warning paths https://github.com/RustPython/RustPython/pull/8947/files#top
Show all changes 2 commits https://github.com/RustPython/RustPython/pull/8947/files
8968e1b Support compile module context across AST warning paths youknowdot Oct 2, 2026 https://github.com/RustPython/RustPython/pull/8947/commits/8968e1bf15a27a164615c5d84235c6cf168f08e9
3cc5388 Adapt compile module context to the current parser APIs youknowone Oct 8, 2026 https://github.com/RustPython/RustPython/pull/8947/commits/3cc5388b1e84a89dc42eef99dbfaf948afcd1d78
Clear filters https://github.com/RustPython/RustPython/pull/8947/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8947/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8947/files
_ast.rs https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
string.rs https://github.com/RustPython/RustPython/pull/8947/files#diff-ac334d16ec968460271dd03617accda2cd6d71249e2c6c01ad642ce92bd33f80
builtins.rs https://github.com/RustPython/RustPython/pull/8947/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
compile.rs https://github.com/RustPython/RustPython/pull/8947/files#diff-e7f70f57a7775d5472ffe0e4fe2f28f1c386fad78bef2ba2c46fd7f2224fa89e
builtin_compile_module.py https://github.com/RustPython/RustPython/pull/8947/files#diff-80df50038ceff1325c565e267ef3b203ee23d5cde80b286dfb88aea85a4942c2
crates/vm/src/stdlib/_ast.rshttps://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
View file https://github.com/youknowdot/RustPython/blob/3cc5388b1e84a89dc42eef99dbfaf948afcd1d78/crates/vm/src/stdlib/_ast.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8947/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
https://github.com/RustPython/RustPython/pull/8947/files#diff-abdef7b5c5b2a09ab3af5a77d683e79ae937bd93b5411799efd4101aacbc7411
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8947/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8947/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.