Skip to content

Align more error messages with CPython 3.14.5#7933

Merged
youknowone merged 4 commits into
RustPython:mainfrom
ShaharNaveh:ruff-error-msg-0
May 20, 2026
Merged

Align more error messages with CPython 3.14.5#7933
youknowone merged 4 commits into
RustPython:mainfrom
ShaharNaveh:ruff-error-msg-0

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh commented May 20, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved syntax error messages with precise location details, including line numbers for unterminated string literals
    • Added clearer error when arguments appear after var-keyword parameters
    • Refined wording and formatting for several other syntax errors and made "expected …" messages more specific

Review Change Stack

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

📦 Library Dependencies

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

[ ] test: cpython/Lib/test/test_syntax.py (TODO: 253)

dependencies:

dependent tests: (no tests depend on syntax)

[x] test: cpython/Lib/test/test_eof.py (TODO: 5)

dependencies:

dependent tests: (no tests depend on eof)

Legend:

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 66d7efa8-706f-4ab1-beba-2d3668aef16d

📥 Commits

Reviewing files that changed from the base of the PR and between f3abe06 and c17af96.

⛔ Files ignored due to path filters (2)
  • Lib/test/test_eof.py is excluded by !Lib/**
  • Lib/test/test_syntax.py is excluded by !Lib/**
📒 Files selected for processing (1)
  • crates/vm/src/vm/vm_new.rs

📝 Walkthrough

Walkthrough

Error message handling in analyze_compile_error is enhanced to capture error location and improve parse error messages. The CompileError::Parse destructuring now binds location to enable precise error reporting. Subsequent error types receive updated messages: unterminated strings include detected line numbers, a new ParamAfterVarKeywordParam case is added, and multiple OtherError cases are rewritten with improved or raw-string formatting.

Changes

Parse Error Message Handling

Layer / File(s) Summary
Parse error location binding
crates/vm/src/vm/vm_new.rs
CompileError::Parse pattern destructuring is updated to bind location for use in downstream error-message formatting.
Error-type-specific message updates
crates/vm/src/vm/vm_new.rs
Unterminated string errors now report detected line numbers, a new ParamAfterVarKeywordParam case is added with its message, and multiple OtherError string-match cases are rewritten with improved or raw-string formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • youknowone

Poem

🐰 A compiler speaks clearer with location in sight,
Each parse error now tells where things went not right,
With line numbers glowing and messages refined,
The rabbit hops forward—no ambiguity in mind!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: aligning error messages with CPython 3.14.5, which matches the error message updates throughout the vm_new.rs file.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@ShaharNaveh ShaharNaveh marked this pull request as draft May 20, 2026 09:44
@ShaharNaveh ShaharNaveh marked this pull request as ready for review May 20, 2026 10:59
Copy link
Copy Markdown
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@youknowone youknowone merged commit ee006af into RustPython:main May 20, 2026
27 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