Handle more memory allocation failures without crashing.

This commit is contained in:
Neal Norwitz 2006-07-21 07:59:47 +00:00
parent 33722aec57
commit d12bd012a6
5 changed files with 38 additions and 8 deletions

View file

@ -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;
}