You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP 758: align unparenthesized-exception SyntaxError metadata with CPython #8496
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: passexcept A, B, C as e: pass"""try:
compile(src, "x.py", "exec")
exceptSyntaxErrorasexc:
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
Activity
zzarbttoo commentedon Aug 14, 2026
take
Match CPython's SyntaxError range for unparenthesized `except` types
Match CPython's SyntaxError range for unparenthesized `except` types
Take SyntaxError messages and ranges from the parser (RustPython#8983)