summaryrefslogtreecommitdiffstats
path: root/Modules/parsermodule.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-04 16:37:31 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-04 16:37:31 (GMT)
commit2bd61a988f3598db41feed19e55efac3eb10bf01 (patch)
tree5148a2da5a62f7398a0fe6f4dbbbb4cfa71dcffa /Modules/parsermodule.c
parent9a492acc14c499f0ec675d58814c9242ed90c021 (diff)
downloadcpython-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.c17
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