pypy3.9: Wrong error message/location for generator expression followed by missing indent
Hi!
This code produces a misleading syntax error in PyPy3.9 (but not in PyPy2, PyPy3.8 and CPython 3.8+):
max(x for x in [])
if False:
missing_indent
$ pypy3 --version
Python 3.9.15 (21401ebc2df332b6be6e3d364a985e951a72bbbd, Dec 07 2022, 01:39:58)
[PyPy 7.3.10 with GCC 12.2.0]
$ pypy3 t.py
File "/tmp/t.py", line 1
max(x for x in [])
^
SyntaxError: Generator expression must be parenthesized
$ /tmp/pypy3.8-v7.3.10-linux64/bin/pypy3 -V
Python 3.8.15 (c20fe3f310f1d209d69a71d903dd17e5c3cf0de9, Dec 05 2022, 15:20:08)
[PyPy 7.3.10 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]
$ /tmp/pypy3.8-v7.3.10-linux64/bin/pypy3 t.py
File "t.py", line 4
missing_indent
^
IndentationError: expected an indented block after 'if' statement on line 3
$ python3 -VV
Python 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]
$ python3 t.py
File "/tmp/t.py", line 4
missing_indent
^
IndentationError: expected an indented block after 'if' statement on line 3
When I originally found this, the missing indent was near the bottom of the file and the genexp was near the top, so it appears that this bug happens regardless of what is in between.