summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-21 07:59:47 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-21 07:59:47 (GMT)
commitd12bd012a6a4729b5a77c1019ca9da4e9d1b7e3e (patch)
treef80aa311a6efe044d51c07f42e734b750be129be /Python/ast.c
parent33722aec5755f1fa8c0660094639174dbbeefb1d (diff)
downloadcpython-d12bd012a6a4729b5a77c1019ca9da4e9d1b7e3e.zip
cpython-d12bd012a6a4729b5a77c1019ca9da4e9d1b7e3e.tar.gz
cpython-d12bd012a6a4729b5a77c1019ca9da4e9d1b7e3e.tar.bz2
Handle more memory allocation failures without crashing.
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 d00fcc8..9180fd0 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;
}