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.

Author lys.nikolaou
Recipients gvanrossum, lys.nikolaou, pablogsal
Date 2020-05-15.12:04:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589544267.84.0.231872596395.issue40631@roundup.psfhosted.org>
In-reply-to
Content
The new PEG parser fails when a parenthesised expression with a single child (a group) contains a starred expression. Example:

╰─ ./python.exe
Python 3.9.0a6+ (heads/master-dirty:4a12d12186, May 15 2020, 14:53:45)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse('(*a)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/lysnikolaou/Repositories/cpython/Lib/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    (*a)
        ^
SyntaxError: invalid syntax

This was valid syntax up until now:

╰─ ./python.exe -X oldparser
Python 3.9.0a6+ (heads/master-dirty:4a12d12186, May 15 2020, 14:53:45)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.dump(ast.parse('(*a)'))
"Module(body=[Expr(value=Starred(value=Name(id='a', ctx=Load()), ctx=Load()))], type_ignores=[])"
History
Date User Action Args
2020-05-15 12:04:27lys.nikolaousetrecipients: + lys.nikolaou, gvanrossum, pablogsal
2020-05-15 12:04:27lys.nikolaousetmessageid: <1589544267.84.0.231872596395.issue40631@roundup.psfhosted.org>
2020-05-15 12:04:27lys.nikolaoulinkissue40631 messages
2020-05-15 12:04:27lys.nikolaoucreate