Title: Align all remaining error messages with CPython by JamesClarke7283 · Pull Request #7993 · RustPython/RustPython · GitHub
Open Graph Title: Align all remaining error messages with CPython by JamesClarke7283 · Pull Request #7993 · RustPython/RustPython
X Title: Align all remaining error messages with CPython by JamesClarke7283 · Pull Request #7993 · RustPython/RustPython
Description: Summary
Continues the parser error-message alignment from #7928 / #7933 / #7988. Translates many more ruff ParseErrorType variants to CPython 3.14.5's exact wording in CompileError::from_ruff_parse_error (using the source slice / parsed AST kind), plus a few codegen/symtable checks.
crates/vm/src/stdlib/_ast.rs now routes its parse errors through from_ruff_parse_error, so ast.parse() / compile(..., PyCF_ONLY_AST) produce the same CPython-aligned messages as the exec path (they previously leaked raw ruff strings — and this fixes a regression where the var-param message diverged on the AST path).
What's aligned
aug-assign / delete / set / dict / f-string / t-string assignment targets
cannot use {attribute,subscript,tuple,list,literal,function call} as import target; import X from Y → "Did you mean to use 'from ... import ...' instead?"
string-prefix incompatibility ('u' and 'b' prefixes are incompatible); invalid character 'X' (U+XXXX)
parenthesized def/lambda params; missing default / argument value; dict : and value syntax
'elif' block follows an 'else' block; raise from; comprehension if / unparenthesized target; ternary statement-keyword hints
match case … as
Open Graph Description: Summary Continues the parser error-message alignment from #7928 / #7933 / #7988. Translates many more ruff ParseErrorType variants to CPython 3.14.5's exact wording in CompileError::from_ruff_p...
X Description: Summary Continues the parser error-message alignment from #7928 / #7933 / #7988. Translates many more ruff ParseErrorType variants to CPython 3.14.5's exact wording in CompileError::from_ru...
Opengraph URL: https://github.com/RustPython/RustPython/pull/7993
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:51df877d-0ff6-13bc-98c8-973627d5bd4b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E3DE:2E8FB4:43FDD33:59C94FC:6A5D6573 |
| html-safe-nonce | 38c73a322b7dd13aa5c4191d8ef1b8c7763454d26cfe960d640dd2dfa0095594 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0RFOjJFOEZCNDo0M0ZERDMzOjU5Qzk0RkM6NkE1RDY1NzMiLCJ2aXNpdG9yX2lkIjoiMTMyOTY0Mzc4MTIzNTc2MjU0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 29be3b00c5a8c15d4c59705f8575dcf0e42238acd0082747ddab05192a4ab400 |
| hovercard-subject-tag | pull_request:3767477913 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/7993/files |
| twitter:image | https://avatars.githubusercontent.com/u/78018345?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/78018345?s=400&v=4 |
| og:image:alt | Summary Continues the parser error-message alignment from #7928 / #7933 / #7988. Translates many more ruff ParseErrorType variants to CPython 3.14.5's exact wording in CompileError::from_ruff_p... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width