bpo-42374: Allow unparenthesized walrus in genexps (GH-23319) (GH-23329)
This fixes a regression that was introduced by the new parser.
(cherry picked from commit cb3e5ed0716114393696ec7201e51fe0595eab4f)
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 60eeb36..257d2f5 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -503,7 +503,7 @@
| '(' a=(yield_expr | named_expression) ')' { a }
| invalid_group
genexp[expr_ty]:
- | '(' a=expression ~ b=for_if_clauses ')' { _Py_GeneratorExp(a, b, EXTRA) }
+ | '(' a=named_expression ~ b=for_if_clauses ')' { _Py_GeneratorExp(a, b, EXTRA) }
| invalid_comprehension
set[expr_ty]: '{' a=expressions_list '}' { _Py_Set(a, EXTRA) }
setcomp[expr_ty]: