Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 45661:ff3e9aeaa692 legacy-trunk
Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::
>>> f(**g(1=2))
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
instead of the expected SyntaxError: keyword can't be an expression
Will backport.
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Wed, 05 Mar 2008 01:50:33 +0000 |
| parents | 393822f2ef90 |
| children | 2a01075cd902 |
line wrap: on
line diff
--- a/Python/ast.c Wed Mar 05 00:44:41 2008 +0000 +++ b/Python/ast.c Wed Mar 05 01:50:33 2008 +0000 @@ -1934,10 +1934,14 @@ } else if (TYPE(ch) == STAR) { vararg = ast_for_expr(c, CHILD(n, i+1)); + if (!vararg) + return NULL; i++; } else if (TYPE(ch) == DOUBLESTAR) { kwarg = ast_for_expr(c, CHILD(n, i+1)); + if (!kwarg) + return NULL; i++; } }
