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 error messages regarding unclosed parentheses
Type: Stage: resolved
Components: Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lys.nikolaou, miss-islington, pablogsal
Priority: normal Keywords: patch

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

Pull Requests
URL Status Linked Edit
PR 24161 merged pablogsal, 2021-01-08 03:04
PR 24266 merged pablogsal, 2021-01-20 12:23
PR 24273 merged pablogsal, 2021-01-20 18:48
Messages (4)
msg384630 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-01-08 03:03
Consider this file:

```
x = (


```

The error that we get is:

❯ python ../a.py
  File "/home/pablogsal/github/python/master/../a.py", line 6

    ^
SyntaxError: unexpected EOF while parsin

This is quite uninformative of the actual problem, which is the closed parentheses.

The same happens with something like this:

( 1+2

  File "/home/pablogsal/github/python/master/lel.py", line 3

    ^
SyntaxError: unexpected EOF while parsing

With some effort, we can include the location of the unclosed parentheses.
msg385307 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-01-19 23:59
New changeset d6d6371447357c9c69b093657bbbb3977a3e60f2 by Pablo Galindo in branch 'master':
bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)
https://github.com/python/cpython/commit/d6d6371447357c9c69b093657bbbb3977a3e60f2
msg385338 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-01-20 12:53
New changeset ae7d3cd980fae6b9a9778c0ccd162b93035ad33e by Pablo Galindo in branch 'master':
bpo-42864: Fix compiler warning in the tokenizer with the new paren stack for column numbers (GH-24266)
https://github.com/python/cpython/commit/ae7d3cd980fae6b9a9778c0ccd162b93035ad33e
msg385362 - (view) Author: miss-islington (miss-islington) Date: 2021-01-20 19:12
New changeset c3f167d7b243f8b8e1b797586e6cef35add013bc by Pablo Galindo in branch 'master':
bpo-42864: Simplify the tokenizer exceptions after generic SyntaxError (GH-24273)
https://github.com/python/cpython/commit/c3f167d7b243f8b8e1b797586e6cef35add013bc
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87030
2021-01-20 19:12:05miss-islingtonsetnosy: + miss-islington
messages: + msg385362
2021-01-20 18:48:59pablogsalsetpull_requests: + pull_request23096
2021-01-20 12:53:59pablogsalsetmessages: + msg385338
2021-01-20 12:23:30pablogsalsetpull_requests: + pull_request23091
2021-01-20 00:07:04pablogsalsetstatus: open -> closed
resolution: fixed
stage: resolved
2021-01-19 23:59:44pablogsalsetmessages: + msg385307
2021-01-08 03:04:28pablogsalsetnosy: + lys.nikolaou

stage: patch review -> (no value)
2021-01-08 03:04:15pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request22988
2021-01-08 03:03:30pablogsalcreate