mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Issue #9128: Fix validation of class decorators in parser module.
This commit is contained in:
parent
9a492acc14
commit
2bd61a988f
3 changed files with 18 additions and 8 deletions
|
@ -2509,14 +2509,15 @@ validate_funcdef(node *tree)
|
|||
static int
|
||||
validate_decorated(node *tree)
|
||||
{
|
||||
int nch = NCH(tree);
|
||||
int ok = (validate_ntype(tree, decorated)
|
||||
&& (nch == 2)
|
||||
&& validate_decorators(RCHILD(tree, -2))
|
||||
&& (validate_funcdef(RCHILD(tree, -1))
|
||||
|| validate_class(RCHILD(tree, -1)))
|
||||
);
|
||||
return ok;
|
||||
int nch = NCH(tree);
|
||||
int ok = (validate_ntype(tree, decorated)
|
||||
&& (nch == 2)
|
||||
&& validate_decorators(RCHILD(tree, -2)));
|
||||
if (TYPE(RCHILD(tree, -1)) == funcdef)
|
||||
ok = ok && validate_funcdef(RCHILD(tree, -1));
|
||||
else
|
||||
ok = ok && validate_class(RCHILD(tree, -1));
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue