summaryrefslogtreecommitdiff
path: root/Python/ast.c
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-03-18 13:51:53 +0000
committerGitHub <noreply@github.com>2019-03-18 13:51:53 +0000
commit0c9258a6d299e0484538ef8d4b23f30515283db2 (patch)
tree0f38434d24356b79691c3fe31206b5cc0b7e701b /Python/ast.c
parent2ddc7f6d6223840c9971b36b30da4b3371d6e52b (diff)
downloadcpython-git-0c9258a6d299e0484538ef8d4b23f30515283db2.tar.gz
bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398)
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 971b8ddc8c..e9154fecff 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -316,13 +316,14 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
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