Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix more
  • Loading branch information
ShaharNaveh committed May 19, 2026
commit b0f24c4acbd7b1780856c867d84ce4eff92103c4
8 changes: 4 additions & 4 deletions Lib/test/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,14 +1705,14 @@
Check that an multiple exception types with missing parentheses
raise a custom exception only when using 'as'

>>> try: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> try:
... pass
... except A, B, C as blech:
... pass
Traceback (most recent call last):
SyntaxError: multiple exception types must be parenthesized when using 'as'

>>> try: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> try:
... pass
... except A, B, C as blech:
... pass
Expand All @@ -1722,14 +1722,14 @@
SyntaxError: multiple exception types must be parenthesized when using 'as'


>>> try: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> try:
... pass
... except* A, B, C as blech:
... pass
Traceback (most recent call last):
SyntaxError: multiple exception types must be parenthesized when using 'as'

>>> try: # TODO: RUSTPYTHON; Wrong error message # doctest: +EXPECTED_FAILURE
>>> try:
... pass
... except* A, B, C as blech:
... pass
Expand Down
8 changes: 8 additions & 0 deletions crates/vm/src/vm/vm_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ impl SyntaxErrorInfo {
"trailing comma not allowed without surrounding parentheses".into()
}

ParseErrorType::OtherError(s)
if s.eq_ignore_ascii_case(
"multiple exception types must be parenthesized when using `as`",
) =>
{
"multiple exception types must be parenthesized when using 'as'".into()
}

_ => {
dbg!(error);
return;
Expand Down