Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 48397:42309437f1ca
Merged revisions 64622 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64622 | benjamin.peterson | 2008-07-01 14:34:52 -0500 (Tue, 01 Jul 2008) | 1 line
#3219 repeated keyword arguments aren't allowed in function calls anymore
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Tue, 01 Jul 2008 20:03:27 +0000 |
| parents | ac854cde3135 |
| children | dbc2b7ad0c22 |
line wrap: on
line diff
--- a/Python/ast.c Tue Jul 01 19:56:00 2008 +0000 +++ b/Python/ast.c Tue Jul 01 20:03:27 2008 +0000 @@ -1968,7 +1968,8 @@ } else { keyword_ty kw; - identifier key; + identifier key, tmp; + int k; /* CHILD(ch, 0) is test, but must be an identifier? */ e = ast_for_expr(c, CHILD(ch, 0)); @@ -1989,6 +1990,13 @@ return NULL; } key = e->v.Name.id; + for (k = 0; k < nkeywords; k++) { + tmp = ((keyword_ty)asdl_seq_GET(keywords, k))->arg; + if (!PyUnicode_Compare(tmp, key)) { + ast_error(CHILD(ch, 0), "keyword argument repeated"); + return NULL; + } + } e = ast_for_expr(c, CHILD(ch, 2)); if (!e) return NULL;
