[New-bugs-announce] [issue45727] Parse error when missing commas is inconsistent

Carl Friedrich Bolz-Tereick report at bugs.python.org
Fri Nov 5 08:44:09 EDT 2021


New submission from Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>:

I found following inconsistency in the error message when there's a missing comma (it behaves that way both on main and 3.10).

Here's what happens with numbers, as expected:

Python 3.11.0a1+ (heads/main:32f55d1a5d, Nov  5 2021, 13:18:52) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 2 3 4
  File "<stdin>", line 1
    1 2 3 4
    ^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

But with names the error is further right in the lines:

>>> a b c d
  File "<stdin>", line 1
    a b c d
      ^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
>>> a b c d e f g
  File "<stdin>", line 1
    a b c d e f g
              ^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

That looks potentially quite confusing to me?

(I don't know if these nit-picky parsing issues are too annoying, if they are please tell me to stop filing them).

----------
messages: 405792
nosy: Carl.Friedrich.Bolz, pablogsal
priority: normal
severity: normal
status: open
title: Parse error when missing commas is inconsistent
versions: Python 3.11

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


More information about the New-bugs-announce mailing list