This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve syntax error for try block without finally or except block
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pablogsal
Priority: normal Keywords: patch

Created on 2021-06-03 21:48 by pablogsal, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26523 merged pablogsal, 2021-06-03 21:52
PR 26524 merged pablogsal, 2021-06-03 22:53
Messages (3)
msg395053 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-06-03 21:48
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
msg395056 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-06-03 22:52
New changeset b250f89bb7e05e72a4641d44b988866b919575db by Pablo Galindo in branch 'main':
bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523)
https://github.com/python/cpython/commit/b250f89bb7e05e72a4641d44b988866b919575db
msg395057 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-06-03 23:11
New changeset e53f72a1b42e17a331ed14bec674b1ee01d0720c by Pablo Galindo in branch '3.10':
[3.10] bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523) (GH-26524)
https://github.com/python/cpython/commit/e53f72a1b42e17a331ed14bec674b1ee01d0720c
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88471
2021-06-03 23:11:51pablogsalsetmessages: + msg395057
2021-06-03 22:53:44pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-06-03 22:53:20pablogsalsetpull_requests: + pull_request25118
2021-06-03 22:52:19pablogsalsetmessages: + msg395056
2021-06-03 21:52:27pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request25117
2021-06-03 21:48:37pablogsalcreate