summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-04 16:28:57 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-04 16:28:57 (GMT)
commit644bef795b2a87ae41cdb308a526d562d77ff116 (patch)
treef5caabb37beb81ed46c0ef998a9ee8218f2b1d6a /Modules
parente9123efa21a16584758b5ce7da93d3966cf0cd81 (diff)
downloadcpython-644bef795b2a87ae41cdb308a526d562d77ff116.zip
cpython-644bef795b2a87ae41cdb308a526d562d77ff116.tar.gz
cpython-644bef795b2a87ae41cdb308a526d562d77ff116.tar.bz2
Issue #9128: Fix validation of class decorators in parser module.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/parsermodule.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 365ec90..097c450 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -2679,14 +2679,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