Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 62772:1eaf4bbe4b1c
Issue #9128: Fix validation of class decorators in parser module.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sun, 04 Jul 2010 16:37:31 +0000 |
| parents | cab14be0ada1 |
| children | c6f16b8cb858 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Sun Jul 04 16:33:07 2010 +0000 +++ b/Modules/parsermodule.c Sun Jul 04 16:37:31 2010 +0000 @@ -2509,14 +2509,15 @@ 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
