bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398)
diff --git a/Python/ast.c b/Python/ast.c
index 971b8dd..e9154fe 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -316,13 +316,14 @@
return validate_exprs(exp->v.List.elts, ctx, 0);
case Tuple_kind:
return validate_exprs(exp->v.Tuple.elts, ctx, 0);
+ case NamedExpr_kind:
+ return validate_expr(exp->v.NamedExpr.value, Load);
/* This last case doesn't have any checking. */
case Name_kind:
return 1;
- default:
- PyErr_SetString(PyExc_SystemError, "unexpected expression");
- return 0;
}
+ PyErr_SetString(PyExc_SystemError, "unexpected expression");
+ return 0;
}
static int