[issue44305] Improve syntax error for try block without finally or except block

Pablo Galindo Salgado report at bugs.python.org
Thu Jun 3 17:48:37 EDT 2021


New submission from Pablo Galindo Salgado <pablogsal at gmail.com>:

Given this script:
try:
    x = 34

a = 1

instead of printing:
  File "/home/pablogsal/github/python/master/lel.py", line 4
    a = 1
    ^
SyntaxError: invalid syntax

we should print:

  File "/home/pablogsal/github/python/master/lel.py", line 4
    a = 1
    ^
SyntaxError: expected 'except' or 'finally' block

----------
messages: 395053
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve syntax error for try block without finally or except block

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44305>
_______________________________________


More information about the Python-bugs-list mailing list