[Python-checkins] r61675 - in python/branches/release25-maint: Lib/test/test_grammar.py Misc/NEWS Python/ast.c
sean.reifschneider
python-checkins at python.org
Thu Mar 20 18:39:32 CET 2008
Author: sean.reifschneider
Date: Thu Mar 20 18:39:31 2008
New Revision: 61675
Modified:
python/branches/release25-maint/Lib/test/test_grammar.py
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Python/ast.c
Log:
Back-port of rev 61240 for issue #2238, fixing: Some syntax errors in *args
and **kwargs expressions could give bogus error messages.
Modified: python/branches/release25-maint/Lib/test/test_grammar.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_grammar.py (original)
+++ python/branches/release25-maint/Lib/test/test_grammar.py Thu Mar 20 18:39:31 2008
@@ -260,6 +260,10 @@
def d32v((x,)): pass
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
print 'lambdef'
l1 = lambda : 0
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Thu Mar 20 18:39:31 2008
@@ -14,6 +14,9 @@
- Issue #2321: use pymalloc for unicode object string data to reduce
memory usage in some circumstances.
+- Issue #2238: Some syntax errors in *args and **kwargs expressions could give
+ bogus error messages.
+
Library
-------
Modified: python/branches/release25-maint/Python/ast.c
==============================================================================
--- python/branches/release25-maint/Python/ast.c (original)
+++ python/branches/release25-maint/Python/ast.c Thu Mar 20 18:39:31 2008
@@ -1878,10 +1878,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++;
}
}
More information about the Python-checkins
mailing list