summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-09-01 20:10:49 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-09-01 20:10:49 (GMT)
commitb3d531348c40b195e6bb742d956ea749b3f7a969 (patch)
tree7f86b2031452f63f26da4dcc09315c960f343320 /Python/ast.c
parentc332e0946a8a676bc98a713f3114cf5f95501f52 (diff)
downloadcpython-b3d531348c40b195e6bb742d956ea749b3f7a969.zip
cpython-b3d531348c40b195e6bb742d956ea749b3f7a969.tar.gz
cpython-b3d531348c40b195e6bb742d956ea749b3f7a969.tar.bz2
Issue #24975: Fix AST compilation for PEP 448 syntax.
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index b572088..b2f09b9 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -199,8 +199,10 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
"Dict doesn't have the same number of keys as values");
return 0;
}
- return validate_exprs(exp->v.Dict.keys, Load, 0) &&
- validate_exprs(exp->v.Dict.values, Load, 0);
+ /* null_ok=1 for keys expressions to allow dict unpacking to work in
+ dict literals, i.e. ``{**{a:b}}`` */
+ return validate_exprs(exp->v.Dict.keys, Load, /*null_ok=*/ 1) &&
+ validate_exprs(exp->v.Dict.values, Load, /*null_ok=*/ 0);
case Set_kind:
return validate_exprs(exp->v.Set.elts, Load, 0);
#define COMP(NAME) \