File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,6 +156,14 @@ def test_function_defs(self):
156156
157157 def test_class_defs (self ):
158158 self .check_suite ("class foo():pass" )
159+ self .check_suite ("@class_decorator\n "
160+ "class foo():pass" )
161+ self .check_suite ("@class_decorator(arg)\n "
162+ "class foo():pass" )
163+ self .check_suite ("@decorator1\n "
164+ "@decorator2\n "
165+ "class foo():pass" )
166+
159167
160168 def test_import_from_statement (self ):
161169 self .check_suite ("from sys.path import *" )
Original file line number Diff line number Diff line change 8181Library
8282-------
8383
84+ - Issue #9128: Fix validation of class decorators in parser module.
85+
8486- Issue #7673: Fix security vulnerability (CVE-2010-2089) in the audioop
8587 module, ensure that the input string length is a multiple of the frame size
8688
Original file line number Diff line number Diff line change @@ -2679,14 +2679,15 @@ validate_funcdef(node *tree)
26792679static int
26802680validate_decorated (node * tree )
26812681{
2682- int nch = NCH (tree );
2683- int ok = (validate_ntype (tree , decorated )
2684- && (nch == 2 )
2685- && validate_decorators (RCHILD (tree , -2 ))
2686- && (validate_funcdef (RCHILD (tree , -1 ))
2687- || validate_class (RCHILD (tree , -1 )))
2688- );
2689- return ok ;
2682+ int nch = NCH (tree );
2683+ int ok = (validate_ntype (tree , decorated )
2684+ && (nch == 2 )
2685+ && validate_decorators (RCHILD (tree , -2 )));
2686+ if (TYPE (RCHILD (tree , -1 )) == funcdef )
2687+ ok = ok && validate_funcdef (RCHILD (tree , -1 ));
2688+ else
2689+ ok = ok && validate_class (RCHILD (tree , -1 ));
2690+ return ok ;
26902691}
26912692
26922693static int
You can’t perform that action at this time.
0 commit comments