summaryrefslogtreecommitdiffstats
path: root/Modules/parsermodule.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-04 16:39:03 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-04 16:39:03 (GMT)
commita441e6465a26b00730cbeae09cf89bcfba6a7c78 (patch)
treea6b5f51a343bc8afc4c1dbf965a016d5a7a78735 /Modules/parsermodule.c
parent775695ad0354aea8248a0d237c38f63649639e1a (diff)
downloadcpython-a441e6465a26b00730cbeae09cf89bcfba6a7c78.zip
cpython-a441e6465a26b00730cbeae09cf89bcfba6a7c78.tar.gz
cpython-a441e6465a26b00730cbeae09cf89bcfba6a7c78.tar.bz2
Merged revisions 82537 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82537 | mark.dickinson | 2010-07-04 17:37:31 +0100 (Sun, 04 Jul 2010) | 2 lines Issue #9128: Fix validation of class decorators in parser module. ........
Diffstat (limited to 'Modules/parsermodule.c')
-rw-r--r--Modules/parsermodule.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index dce85c2..b00037d 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -2507,14 +2507,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