mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-40147: Move the check for duplicate keywords to the compiler (GH-19289)
This commit is contained in:
parent
bd6a4c3d72
commit
254ec78341
4 changed files with 32 additions and 12 deletions
11
Python/ast.c
11
Python/ast.c
|
@ -3048,8 +3048,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func,
|
|||
else {
|
||||
/* a keyword argument */
|
||||
keyword_ty kw;
|
||||
identifier key, tmp;
|
||||
int k;
|
||||
identifier key;
|
||||
|
||||
// To remain LL(1), the grammar accepts any test (basically, any
|
||||
// expression) in the keyword slot of a call site. So, we need
|
||||
|
@ -3093,14 +3092,6 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func,
|
|||
if (forbidden_name(c, key, chch, 1)) {
|
||||
return NULL;
|
||||
}
|
||||
for (k = 0; k < nkeywords; k++) {
|
||||
tmp = ((keyword_ty)asdl_seq_GET(keywords, k))->arg;
|
||||
if (tmp && !PyUnicode_Compare(tmp, key)) {
|
||||
ast_error(c, chch,
|
||||
"keyword argument repeated");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
e = ast_for_expr(c, CHILD(ch, 2));
|
||||
if (!e)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue