diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-07-04 16:23:54 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-07-04 16:23:54 (GMT) |
commit | a7ee59b3d33327ec6f9f34da97d16344a1121199 (patch) | |
tree | 7890243094f88b7105d353e34214e94a8f13460c /Modules | |
parent | 96c4df4532de5b4b223ef4f31aacbe6a97bf65b0 (diff) | |
download | cpython-a7ee59b3d33327ec6f9f34da97d16344a1121199.zip cpython-a7ee59b3d33327ec6f9f34da97d16344a1121199.tar.gz cpython-a7ee59b3d33327ec6f9f34da97d16344a1121199.tar.bz2 |
Issue #9128: Validate class decorator syntax correctly in parser module.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/parsermodule.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 5d1bfb6..4a581d7 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -2682,14 +2682,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 |