[issue40631] PEG Parser: Cannot used starred expression in parenthesised expr
Lysandros Nikolaou
report at bugs.python.org
Fri May 15 08:04:27 EDT 2020
New submission from Lysandros Nikolaou <lisandrosnik at gmail.com>:
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=[])"
----------
assignee: lys.nikolaou
components: Interpreter Core
messages: 368936
nosy: gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: PEG Parser: Cannot used starred expression in parenthesised expr
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40631>
_______________________________________
More information about the Python-bugs-list
mailing list