[issue34013] Inconsistent SyntaxError for print

Brandt Bucher report at bugs.python.org
Sat Jul 31 13:25:32 EDT 2021


Brandt Bucher <brandtbucher at gmail.com> added the comment:

Reopening as a release blocker.

It appears that this new rule is far too eager, and matches a much wider range of inputs than intended. Here is a case where it changes an IndentationError into a SyntaxError:

$ cat bug.py
print()
    boom

On 3.9 (correct):

$ ./python.exe --version
Python 3.9.6+
$ ./python.exe bug.py
  File "/Users/brandtbucher/Desktop/GitHub/cpython/bug.py", line 2
    boom
IndentationError: unexpected indent

On 3.10 (incorrect):

$ ./python.exe --version
Python 3.10.0b4+
$ ./python.exe bug.py
  File "/Users/brandtbucher/Desktop/GitHub/cpython/bug.py", line 1
    print()
    ^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

On 3.11 (incorrect):

$ ./python.exe --version
Python 3.11.0a0
$ ./python.exe bug.py
  File "/Users/brandtbucher/Desktop/GitHub/cpython/bug.py", line 1
    print()
    ^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

I recommend that this either be fixed or reverted before the RC.

----------
components: +Parser -Interpreter Core
nosy: +brandtbucher
priority: normal -> release blocker
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
type: enhancement -> behavior

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


More information about the Python-bugs-list mailing list