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.
........
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 @@
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