summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_grammar.py4
-rw-r--r--Misc/NEWS6
-rw-r--r--Python/ast.c4
3 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index e2bb3eb..0e59367 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -282,6 +282,10 @@ class GrammarTests(unittest.TestCase):
def d32v((x,)): pass
d32v((1,))
+ # Check ast errors in *args and *kwargs
+ check_syntax_error(self, "f(*g(1=2))")
+ check_syntax_error(self, "f(**g(1=2))")
+
def testLambdef(self):
### lambdef: 'lambda' [varargslist] ':' test
l1 = lambda : 0
diff --git a/Misc/NEWS b/Misc/NEWS
index 4fac859..4992513 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,12 @@ What's New in Python 2.6 alpha 2?
*Release date: XX-XXX-2008*
+Core and builtins
+-----------------
+
+- Issue #2238: Some syntax errors in *args and **kwargs expressions could give
+ bogus error messages.
+
What's New in Python 2.6 alpha 1?
=================================
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++;
}
}