diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-03-05 01:50:33 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-03-05 01:50:33 (GMT) |
commit | d21fb4c2e097dd72d1772a6f0325cc45f9b20f30 (patch) | |
tree | 3a41c2f003bd75ac8855abcab177010dc7577760 /Python | |
parent | 3710a135067f72322d07df4f5916bcec61ae25d5 (diff) | |
download | cpython-d21fb4c2e097dd72d1772a6f0325cc45f9b20f30.zip cpython-d21fb4c2e097dd72d1772a6f0325cc45f9b20f30.tar.gz cpython-d21fb4c2e097dd72d1772a6f0325cc45f9b20f30.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index 7a1b5bc..e14ff3a 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1934,10 +1934,14 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func) } 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++; } } |