diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-03-18 13:51:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-18 13:51:53 (GMT) |
commit | 0c9258a6d299e0484538ef8d4b23f30515283db2 (patch) | |
tree | 0f38434d24356b79691c3fe31206b5cc0b7e701b /Python | |
parent | 2ddc7f6d6223840c9971b36b30da4b3371d6e52b (diff) | |
download | cpython-0c9258a6d299e0484538ef8d4b23f30515283db2.zip cpython-0c9258a6d299e0484538ef8d4b23f30515283db2.tar.gz cpython-0c9258a6d299e0484538ef8d4b23f30515283db2.tar.bz2 |
bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 7 |
1 files changed, 4 insertions, 3 deletions
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 @@ 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 |