FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Take SyntaxError messages and ranges from the parser by youknowone · Pull Request #8983 · RustPython/RustPython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
776ab5d
Match CPython's SyntaxError range for unparenthesized `except` types
zzarbttoo Sep 6, 2026
e491d0d
Clarify that the `except` error range stops before the closing colon
zzarbttoo Sep 20, 2026
abacad2
Fix the `except ... as` error column for non-ASCII names and line joins
zzarbttoo Sep 20, 2026
5931324
Update the Ruff fork to 0.16.10
youknowone Oct 4, 2026
264650b
Drop the source scan for the `except ... as` error range
youknowone Oct 4, 2026
c1ed646
Take parse error messages from the parser as they are
youknowone Oct 4, 2026
fe81dff
Take starred and bytes literal error ranges from the parser
youknowone Oct 4, 2026
718e61a
Take indentation error kinds and positions from the parser
youknowone Oct 4, 2026
645631b
Take unterminated string messages from the parser
youknowone Oct 4, 2026
8f74913
Take bracket errors and tokenizer error priority from the parser
youknowone Oct 4, 2026
61b4032
Take number literal, string prefix and non-printable errors from the …
youknowone Oct 4, 2026
efe3856
Take the missing indented block error from the parser
youknowone Oct 4, 2026
b4660b4
Take binding target errors from the parser
youknowone Oct 4, 2026
2523208
Take parameter, argument, star, comma and dictionary errors from the …
youknowone Oct 4, 2026
13f1a00
Take expression errors from the parser
youknowone Oct 4, 2026
a47ad11
Take statement errors from the parser
youknowone Oct 5, 2026
450242a
Take string and f-string errors from the parser
youknowone Oct 5, 2026
f5af0dd
Restore the bracket depth check and fix incomplete unclosed strings
youknowone Oct 6, 2026
8cfafa1
Report multiple statements before later errors in single mode
youknowone Oct 6, 2026
a099d0b
Update the Ruff fork for parser speed and starred annotations
youknowone Oct 6, 2026
820917a
Use the published Ruff fork 0.16.10 crates
youknowone Oct 7, 2026
File filter

Filter by extension

Filter by extension .lock  (1) .py  (10) .rs  (13) .toml  (1) All 4 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
48 changes: 26 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ rustpython-wtf8 = { path = "crates/wtf8", version = "0.6.1" }
rustpython-doc = { path = "crates/doc", version = "0.6.1" }

# Use the RustPython Ruff fork for RustPython public `_ast` metadata.
ruff_python_parser = { package = "rustpython-ruff_python_parser", version = "0.16.5" }
ruff_python_ast = { package = "rustpython-ruff_python_ast", version = "0.16.5" }
ruff_text_size = { package = "rustpython-ruff_text_size", version = "0.16.5" }
ruff_source_file = { package = "rustpython-ruff_source_file", version = "0.16.5" }
ruff_python_parser = { package = "rustpython-ruff_python_parser", version = "0.16.10" }
ruff_python_ast = { package = "rustpython-ruff_python_ast", version = "0.16.10" }
ruff_text_size = { package = "rustpython-ruff_text_size", version = "0.16.10" }
ruff_source_file = { package = "rustpython-ruff_source_file", version = "0.16.10" }

der = { version = "0.8", features = ["alloc", "oid", "pem", "zeroize"] }
phf = { version = "0.14.0", default-features = false, features = ["macros"]}
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_code_module.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def test_syntax_error(self):
self.assertIsNone(self.sysmod.last_value.__traceback__)
self.assertIs(self.sysmod.last_exc, self.sysmod.last_value)

@unittest.expectedFailure # TODO: RUSTPYTHON; - 'IndentationError: unexpected indentation']
def test_indentation_error(self):
self.infunc.side_effect = [" 1", EOFError('Finished')]
self.console.interact()
Expand Down Expand Up @@ -187,7 +186,6 @@ def test_sysexcepthook_syntax_error(self):
' ^\n',
'SyntaxError: invalid syntax\n'])

@unittest.expectedFailure # TODO: RUSTPYTHON; + 'IndentationError: unexpected indent\n']
def test_sysexcepthook_indentation_error(self):
self.infunc.side_effect = [" 1", EOFError('Finished')]
hook = mock.Mock()
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_dictcomps.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_local_visibility(self):
self.assertEqual(actual, expected)
self.assertEqual(v, "Local variable")

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_illegal_assignment(self):
with self.assertRaisesRegex(SyntaxError, "cannot assign"):
compile("{x: y for y, x in ((1, 2), (3, 4))} = 5", "<test>",
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_fstring.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ def __format__(self, spec):
x = X()
self.assertEqual(f'{x} {x}', '1 2')

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_missing_expression(self):
self.assertAllRaise(SyntaxError,
"f-string: valid expression required before '}'",
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_named_expressions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def test_named_expression_invalid_16(self):
with self.assertRaisesRegex(SyntaxError, "invalid syntax"):
exec(code, {}, {})

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_named_expression_invalid_17(self):
code = "[i := 0, j := 1 for i, j in [(1, 2), (3, 4)]]"

Expand Down
42 changes: 21 additions & 21 deletions Lib/test/test_syntax.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@

# Incorrectly closed strings

>>> "The interesting object "The important object" is very important" # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> "The interesting object "The important object" is very important"
Traceback (most recent call last):
SyntaxError: invalid syntax. Is this intended to be part of the string?

Expand Down Expand Up @@ -423,7 +423,7 @@
Traceback (most recent call last):
SyntaxError: invalid syntax

>>> def foo(/,a,b=,c): # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> def foo(/,a,b=,c):
... pass
Traceback (most recent call last):
SyntaxError: at least one argument must precede /
Expand Down Expand Up @@ -1045,23 +1045,23 @@
a complex 'if' (one with 'elif') would fail to notice an invalid suite,
leading to spurious errors.

>>> if 1: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> if 1:
... x() = 1
... elif 1:
... pass
Traceback (most recent call last):
...
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?

>>> if 1: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> if 1:
... pass
... elif 1:
... x() = 1
Traceback (most recent call last):
...
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?

>>> if 1: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> if 1:
... x() = 1
... elif 1:
... pass
Expand All @@ -1071,7 +1071,7 @@
...
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?

>>> if 1: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> if 1:
... pass
... elif 1:
... x() = 1
Expand All @@ -1081,7 +1081,7 @@
...
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?

>>> if 1: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> if 1:
... pass
... elif 1:
... pass
Expand Down Expand Up @@ -1185,7 +1185,7 @@
Traceback (most recent call last):
SyntaxError: expected ':'

>>> with (blech as something) # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> with (blech as something)
... pass
Traceback (most recent call last):
SyntaxError: expected ':'
Expand All @@ -1195,12 +1195,12 @@
Traceback (most recent call last):
SyntaxError: expected ':'

>>> with (blech, block as something) # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> with (blech, block as something)
... pass
Traceback (most recent call last):
SyntaxError: expected ':'

>>> with (blech, block as something, bluch) # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> with (blech, block as something, bluch)
... pass
Traceback (most recent call last):
SyntaxError: expected ':'
Expand Down Expand Up @@ -1464,7 +1464,7 @@
Traceback (most recent call last):
SyntaxError: invalid syntax

>>> dict(x=34, (x for x in range 10), 1); x $ y # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> dict(x=34, (x for x in range 10), 1); x $ y
Traceback (most recent call last):
SyntaxError: invalid syntax

Expand Down Expand Up @@ -2077,26 +2077,26 @@
Traceback (most recent call last):
SyntaxError: cannot use literal as import target

>>> from a import (b as c.d) # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> from a import (b as c.d)
Traceback (most recent call last):
SyntaxError: cannot use attribute as import target

>>> from a import b as 1
Traceback (most recent call last):
SyntaxError: cannot use literal as import target

>>> from a import ( # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> from a import (
... b as f())
Traceback (most recent call last):
SyntaxError: cannot use function call as import target

>>> from a import ( # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> from a import (
... b as [],
... )
Traceback (most recent call last):
SyntaxError: cannot use list as import target

>>> from a import ( # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> from a import (
... b,
... c as ()
... )
Expand Down Expand Up @@ -2233,7 +2233,7 @@
Traceback (most recent call last):
SyntaxError: cannot assign to __debug__

>>> import ä £ # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> import ä £
Traceback (most recent call last):
SyntaxError: invalid character '£' (U+00A3)

Expand All @@ -2245,7 +2245,7 @@
Traceback (most recent call last):
SyntaxError: cannot use '_' as a target

>>> match ...: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> match ...:
... case 42 as 1+2+4:
... ...
Traceback (most recent call last):
Expand All @@ -2263,13 +2263,13 @@
Traceback (most recent call last):
SyntaxError: cannot use tuple as pattern target

>>> match ...: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> match ...:
... case 42 as (a + 1):
... ...
Traceback (most recent call last):
SyntaxError: cannot use expression as pattern target

>>> match ...: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> match ...:
... case (32 as x) | (42 as a()):
... ...
Traceback (most recent call last):
Expand Down Expand Up @@ -2375,7 +2375,7 @@

A[*:] and A[:*]

>>> A[*:] # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> A[*:]
Traceback (most recent call last):
...
SyntaxError: Invalid star expression
Expand All @@ -2386,7 +2386,7 @@

A[*]

>>> A[*] # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> A[*]
Traceback (most recent call last):
...
SyntaxError: Invalid star expression
Expand Down
Loading
Loading

Back | FazBrowse Home | New Git URL