[New-bugs-announce] [issue44201] REPL requests another line despite syntax error

Guido van Rossum report at bugs.python.org
Thu May 20 20:34:22 EDT 2021


New submission from Guido van Rossum <guido at python.org>:

This seems a regression from 3.9.

>>> foo[x = 1
... ]
  File "<stdin>", line 1
    foo[x = 1
        ^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
>>>

Note how the syntax error is in line 1 and yet the REPL asks for more input (the "..." prompt) and doesn't stop until I type "]".

In 3.9 I just get "SyntaxError: invalid syntax" but the REPL doesn't ask for the second line:

>>> foo[x = 1
  File "<stdin>", line 1
    foo[x = 1
          ^
SyntaxError: invalid syntax
>>>

----------
messages: 394087
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: REPL requests another line despite syntax error
type: compile error
versions: Python 3.10

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


More information about the New-bugs-announce mailing list