Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed
Description
Bug report
Given the following codes:
try: ...except*Exception: ...exceptException:# SyntaxError here ...# but traceback point here
Traceback:
File "main.py", line 8 # but traceback point hereSyntaxError: cannot have both 'except' and 'except*' on the same 'try'
and:
try: ...except*Exception: ...exceptException:# SyntaxError here ...defnext_scope():# but traceback point here ...
Traceback:
File "main.py", line 8 def next_scope(): # but traceback point here ^^^SyntaxError: cannot have both 'except' and 'except*' on the same 'try'
The traceback points to a confusing place (the last line of the file or the beginning of the next structure statement) rather than the location of the syntax error.
The traceback I expect is:
File "main.py", line 5 except Exception: # SyntaxError here ^^^^^^SyntaxError: cannot have both 'except' and 'except*' on the same 'try'
Your environment
- CPython versions tested on: 3.11.0
- Operating system and architecture: Ubuntu 22.04 x86_64