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: Bug in Error messages
Type: enhancement Stage: resolved
Components: Parser Versions: Python 3.10
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: UnknownLITE, corona10, eric.smith, godlygeek, lys.nikolaou, pablogsal
Priority: normal Keywords:

Created on 2021-12-04 14:55 by UnknownLITE, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Screenshot 2021-12-04 202054.png UnknownLITE, 2021-12-04 14:55
Messages (5)
msg407670 - (view) Author: UnknownLITE (UnknownLITE) Date: 2021-12-04 14:55
A dot is missing between `now()` and `strftime` but it is suggesting that most probably a comma is missing.
msg407671 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-12-04 15:46
Syntactically, this could be many possible errors: missing comma, missing period, missing parens, missing brackets, etc.

A human can figure it out based on semantics, but based purely on syntax, I think this error message is good enough.
msg407672 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-12-04 15:53
I concur with Eric: the purpose of the error message is a suggestion based in the most likely cause. Also  we have recently refined this so I will trigger in less uncommon situations.
msg407683 - (view) Author: Matt Wozniski (godlygeek) * Date: 2021-12-04 19:16
> Syntactically, this could be many possible errors: missing comma, missing period, missing parens, missing brackets, etc.

Syntactically, it cannot be a missing comma. Adding the comma is a syntax error.

$ python3 -c 'if datetime.now(),strftime(...) != "19:50:00": pass'
  File "<string>", line 1
    if datetime.now(),strftime(...) != "19:50:00": pass
                     ^
SyntaxError: invalid syntax

Granted this is a heuristic, but it would be nice if it was able to not suggest a change that it would reject as syntactically incorrect.
msg407686 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-12-04 21:16
It doesn't happen anymore with the latest 3.10:

>>> if datetime.now()strftime(...) != "19:50:00": pass
  File "<stdin>", line 1
    if datetime.now()strftime(...) != "19:50:00": pass
                     ^^^^^^^^
SyntaxError: invalid syntax
History
Date User Action Args
2022-04-11 14:59:53adminsetgithub: 90140
2021-12-04 21:16:42pablogsalsetmessages: - msg407685
2021-12-04 21:16:39pablogsalsetmessages: + msg407686
2021-12-04 21:15:49pablogsalsetmessages: + msg407685
2021-12-04 19:16:46godlygeeksetnosy: + godlygeek
messages: + msg407683
2021-12-04 15:53:44pablogsalsetstatus: open -> closed
resolution: not a bug
messages: + msg407672

stage: resolved
2021-12-04 15:46:31eric.smithsetnosy: + pablogsal, eric.smith, lys.nikolaou
messages: + msg407671
components: + Parser, - Interpreter Core
2021-12-04 15:16:12corona10setnosy: + corona10
2021-12-04 14:55:58UnknownLITEcreate