[Python-3000-checkins] r55708 - python/branches/p3yk/Python/ast.c

guido.van.rossum python-3000-checkins at python.org
Thu May 31 15:22:58 CEST 2007


Author: guido.van.rossum
Date: Thu May 31 15:22:57 2007
New Revision: 55708

Modified:
   python/branches/p3yk/Python/ast.c
Log:
Fix a fairly long-standing bug in the check for assignment to None (and other
keywords, these days).  In 2.5, you could write foo(None=1) without getting
a SyntaxError (although foo()'s definition would have to use **kwds to avoid
getting a runtime error complaining about an unknown keyword of course).

This ought to be backported to 2.5.2 or at least 2.6.


Modified: python/branches/p3yk/Python/ast.c
==============================================================================
--- python/branches/p3yk/Python/ast.c	(original)
+++ python/branches/p3yk/Python/ast.c	Thu May 31 15:22:57 2007
@@ -1918,7 +1918,9 @@
                 } else if (e->kind != Name_kind) {
                   ast_error(CHILD(ch, 0), "keyword can't be an expression");
                   return NULL;
-                }
+                } else if (forbidden_name(e, ch)) {
+		  return NULL;
+		}
                 key = e->v.Name.id;
                 e = ast_for_expr(c, CHILD(ch, 2));
                 if (!e)


More information about the Python-3000-checkins mailing list