#8496·RustPython

PEP 758: align unparenthesized-exception SyntaxError metadata with CPython

Author: youknowoneCreated Aug 11, 2026Updated Aug 14, 2026
LabelsC-compat

Feature

PEP 758's valid unparenthesized except and except* forms work. The remaining incompatibility is the SyntaxError location/text metadata for invalid unparenthesized exception lists used with as.

Minimal reproduction:

src = """\
try:
    pass
except A, B, C as e:
    pass
"""

try:
    compile(src, "x.py", "exec")
except SyntaxError as exc:
    print(exc.msg)
    print(exc.args[1])

CPython 3.14.6:

multiple exception types must be parenthesized when using 'as'
('x.py', 3, 2, '\n', 3, 2)

RustPython:

multiple exception types must be parenthesized when using 'as'
('x.py', 3, 8, 'except A, B, C as e:\n', 3, 15)

The same location mismatch occurs for except* A, B, C as e:.

This issue is only about CPython-compatible exception metadata; valid PEP 758 syntax, runtime behavior, and ast.parse(..., feature_version=...) gating already work.

Python Documentation or reference to CPython source code