mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Back-port of rev 61240 for issue #2238, fixing: Some syntax errors in *args
and **kwargs expressions could give bogus error messages.
This commit is contained in:
parent
eff5a4e901
commit
4af861cb4e
3 changed files with 11 additions and 0 deletions
|
@ -260,6 +260,10 @@ d31v(1)
|
||||||
def d32v((x,)): pass
|
def d32v((x,)): pass
|
||||||
d32v((1,))
|
d32v((1,))
|
||||||
|
|
||||||
|
# Check ast errors in *args and *kwargs
|
||||||
|
check_syntax("f(*g(1=2))")
|
||||||
|
check_syntax("f(**g(1=2))")
|
||||||
|
|
||||||
### lambdef: 'lambda' [varargslist] ':' test
|
### lambdef: 'lambda' [varargslist] ':' test
|
||||||
print 'lambdef'
|
print 'lambdef'
|
||||||
l1 = lambda : 0
|
l1 = lambda : 0
|
||||||
|
|
|
@ -14,6 +14,9 @@ Core and builtins
|
||||||
- Issue #2321: use pymalloc for unicode object string data to reduce
|
- Issue #2321: use pymalloc for unicode object string data to reduce
|
||||||
memory usage in some circumstances.
|
memory usage in some circumstances.
|
||||||
|
|
||||||
|
- Issue #2238: Some syntax errors in *args and **kwargs expressions could give
|
||||||
|
bogus error messages.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -1878,10 +1878,14 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func)
|
||||||
}
|
}
|
||||||
else if (TYPE(ch) == STAR) {
|
else if (TYPE(ch) == STAR) {
|
||||||
vararg = ast_for_expr(c, CHILD(n, i+1));
|
vararg = ast_for_expr(c, CHILD(n, i+1));
|
||||||
|
if (!vararg)
|
||||||
|
return NULL;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else if (TYPE(ch) == DOUBLESTAR) {
|
else if (TYPE(ch) == DOUBLESTAR) {
|
||||||
kwarg = ast_for_expr(c, CHILD(n, i+1));
|
kwarg = ast_for_expr(c, CHILD(n, i+1));
|
||||||
|
if (!kwarg)
|
||||||
|
return NULL;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue