diff options
author | Georg Brandl <georg@python.org> | 2007-06-07 13:23:28 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-06-07 13:23:28 +0000 |
commit | 73c958aced6d94fb325e7521039c2f95d994f7fe (patch) | |
tree | 01ba870dfeac46b65db350e5576bfd25328d4a8d /Python | |
parent | c98da3d811c77e201a28d8526cb1b0e10c0f4d05 (diff) | |
download | cpython-git-73c958aced6d94fb325e7521039c2f95d994f7fe.tar.gz |
Disallow function calls like foo(None=1).
Backport from py3k rev. 55708 by Guido.
(backport from rev. 55802)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Python/ast.c b/Python/ast.c index 67f45ed068..2a27b64698 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1855,13 +1855,18 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func) * then is very confusing. */ if (e->kind == Lambda_kind) { - ast_error(CHILD(ch, 0), "lambda cannot contain assignment"); - return NULL; + ast_error(CHILD(ch, 0), + "lambda cannot contain assignment"); + return NULL; } else if (e->kind != Name_kind) { - ast_error(CHILD(ch, 0), "keyword can't be an expression"); - return NULL; + ast_error(CHILD(ch, 0), "keyword can't be an expression"); + return NULL; } key = e->v.Name.id; + if (!strcmp(PyString_AS_STRING(key), "None")) { + ast_error(CHILD(ch, 0), "assignment to None"); + return NULL; + } e = ast_for_expr(c, CHILD(ch, 2)); if (!e) return NULL; |