* Collapse bare ExpectedExpression to 'invalid syntax'; fix '<>' diagnostic offset
`ParseErrorType::ExpectedExpression` currently surfaces as the raw ruff
parser message (e.g. "Expected an expression") to callers that only
depend on `rustpython-compiler` (no `rustpython-vm`). `rustpython-vm`'s
`vm_new.rs` already collapses this to CPython's generic "invalid
syntax" for its own callers; mirror that same collapse inside
`cpython_parse_diagnostic_override` so non-vm consumers get the same
CPython-compatible message.
A bare `<>` outside Barry-as-BDFL mode (`2 <> 3`) lexes as `Less` then
an unexpected `Greater`, so the resulting `ExpectedExpression` location
points at the `>` -- one character past where CPython's tokenizer
(which treats `<>` as a single obsolete token) reports the error.
Detect the `<` immediately preceding the location and shift the
reported range back over it.
Assisted-by: Claude Code:claude-sonnet-5
* Require an adjacent '>' before treating '<' as the obsolete <> operator
CodeRabbit review on #8540: the previous check only looked at the byte
before the ExpectedExpression location for '<', without confirming an
adjacent '>' really follows it. For inputs like a trailing '<' at EOF
this could misclassify an unrelated ExpectedExpression as the bare '<>'
case and report a bogus range. Require both bytes are present before
constructing the diagnostic.
Also remove the now-stale `@unittest.expectedFailure # TODO: RUSTPYTHON`
markers on test_guido_as_bdfl and test_barry_as_bdfl_relative_import,
which pass with this fix (test_barry_as_bdfl and
test_barry_as_bdfl_look_ma_with_no_compiler_flags still need real
Barry-as-BDFL tokenizer support and stay marked).
Assisted-by: Claude Code:claude-sonnet-5
This directory contains all of the Python files that make up the standard
library for RustPython.
Most of these files are copied over from the CPython repository (the 3.7
branch), with slight modifications to allow them to work under RustPython. The
current goal is to complete the standard library with as few modifications as
possible. Current modifications are just temporary workarounds for bugs/missing
feature within the RustPython implementation.
The first big module we are targeting is unittest, so we can leverage the
CPython test suite.