Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 64185:38ceeae0d1f0 3.1
Merged revisions 84214 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84214 | amaury.forgeotdarc | 2010-08-19 23:32:38 +0200 (jeu., 19 août 2010) | 3 lines
Add tests for r84209 (crashes in the Ast builder)
Also remove one tab, and move a check closer to the possible failure.
........
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Thu, 19 Aug 2010 21:35:59 +0000 |
| parents | 54c9c86ad104 |
| children | 42b84d3188d1 |
line wrap: on
line diff
--- a/Python/ast.c Thu Aug 19 20:26:00 2010 +0000 +++ b/Python/ast.c Thu Aug 19 21:35:59 2010 +0000 @@ -674,7 +674,7 @@ 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 */ } @@ -873,14 +873,14 @@ 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; i += 3; break; default:
