[Python-checkins] r46045 - in python/trunk: Lib/test/test_syntax.py Python/ast.c
neal.norwitz
python-checkins at python.org
Fri May 19 08:43:51 CEST 2006
Author: neal.norwitz
Date: Fri May 19 08:43:50 2006
New Revision: 46045
Modified:
python/trunk/Lib/test/test_syntax.py
python/trunk/Python/ast.c
Log:
Fix #1474677, non-keyword argument following keyword.
Modified: python/trunk/Lib/test/test_syntax.py
==============================================================================
--- python/trunk/Lib/test/test_syntax.py (original)
+++ python/trunk/Lib/test/test_syntax.py Fri May 19 08:43:50 2006
@@ -309,6 +309,9 @@
"unindent does not match .* level",
subclass=IndentationError)
+ def test_kwargs_last(self):
+ self._check_error("int(base=10, '2')", "non-keyword arg")
+
def test_main():
test_support.run_unittest(SyntaxTestCase)
from test import test_syntax
Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c (original)
+++ python/trunk/Python/ast.c Fri May 19 08:43:50 2006
@@ -1750,6 +1750,11 @@
if (TYPE(ch) == argument) {
expr_ty e;
if (NCH(ch) == 1) {
+ if (nkeywords) {
+ ast_error(CHILD(ch, 0),
+ "non-keyword arg after keyword arg");
+ return NULL;
+ }
e = ast_for_expr(c, CHILD(ch, 0));
if (!e)
return NULL;
More information about the Python-checkins
mailing list