summaryrefslogtreecommitdiff
path: root/Python/ast.c
diff options
context:
space:
mode:
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 d00fcc8bdd..9180fd0d69 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -638,8 +638,10 @@ ast_for_arguments(struct compiling *c, const node *n)
anything other than EQUAL or a comma? */
/* XXX Should NCH(n) check be made a separate check? */
if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) {
- asdl_seq_SET(defaults, j++,
- ast_for_expr(c, CHILD(n, i + 2)));
+ expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));
+ if (!expression)
+ goto error;
+ asdl_seq_SET(defaults, j++, expression);
i += 2;
found_default = 1;
}