diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-07-04 16:37:31 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-07-04 16:37:31 (GMT) |
commit | 2bd61a988f3598db41feed19e55efac3eb10bf01 (patch) | |
tree | 5148a2da5a62f7398a0fe6f4dbbbb4cfa71dcffa /Modules/parsermodule.c | |
parent | 9a492acc14c499f0ec675d58814c9242ed90c021 (diff) | |
download | cpython-2bd61a988f3598db41feed19e55efac3eb10bf01.zip cpython-2bd61a988f3598db41feed19e55efac3eb10bf01.tar.gz cpython-2bd61a988f3598db41feed19e55efac3eb10bf01.tar.bz2 |
Issue #9128: Fix validation of class decorators in parser module.
Diffstat (limited to 'Modules/parsermodule.c')
-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 3e0f530..e60f23d 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -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 |