diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2010-08-19 21:32:38 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2010-08-19 21:32:38 (GMT) |
commit | 12844e6df6d6ae2a8b51e6440b8b15b10a78949a (patch) | |
tree | d2e307d7388c73a02e500a0b51fa3ed979a2c38f /Python | |
parent | 8101021eae574bc65952c0a0027ed9af67420a76 (diff) | |
download | cpython-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.zip cpython-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.tar.gz cpython-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.tar.bz2 |
Add tests for r84209 (crashes in the Ast builder)
Also remove one tab, and move a check closer to the possible failure.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ast.c b/Python/ast.c index 6ea830b..9f6b7ea 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -689,7 +689,7 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start, if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) { expression = ast_for_expr(c, CHILD(n, i + 2)); if (!expression) - goto error; + goto error; asdl_seq_SET(kwdefaults, j, expression); i += 2; /* '=' and test */ } @@ -892,14 +892,14 @@ ast_for_arguments(struct compiling *c, const node *n) ch = CHILD(n, i+1); /* tfpdef */ assert(TYPE(ch) == tfpdef || TYPE(ch) == vfpdef); kwarg = NEW_IDENTIFIER(CHILD(ch, 0)); + if (!kwarg) + return NULL; if (NCH(ch) > 1) { /* there is an annotation on the kwarg */ kwargannotation = ast_for_expr(c, CHILD(ch, 2)); if (!kwargannotation) return NULL; } - if (!kwarg) - return NULL; if (forbidden_name(kwarg, CHILD(ch, 0), 0)) return NULL; i += 3; |