mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #9128: Fix validation of class decorators in parser module.
This commit is contained in:
		
							parent
							
								
									9a492acc14
								
							
						
					
					
						commit
						2bd61a988f
					
				
					 3 changed files with 18 additions and 8 deletions
				
			
		|  | @ -149,6 +149,13 @@ def test_function_defs(self): | ||||||
|     def test_class_defs(self): |     def test_class_defs(self): | ||||||
|         self.check_suite("class foo():pass") |         self.check_suite("class foo():pass") | ||||||
|         self.check_suite("class foo(object):pass") |         self.check_suite("class foo(object):pass") | ||||||
|  |         self.check_suite("@class_decorator\n" | ||||||
|  |                          "class foo():pass") | ||||||
|  |         self.check_suite("@class_decorator(arg)\n" | ||||||
|  |                          "class foo():pass") | ||||||
|  |         self.check_suite("@decorator1\n" | ||||||
|  |                          "@decorator2\n" | ||||||
|  |                          "class foo():pass") | ||||||
| 
 | 
 | ||||||
|     def test_import_from_statement(self): |     def test_import_from_statement(self): | ||||||
|         self.check_suite("from sys.path import *") |         self.check_suite("from sys.path import *") | ||||||
|  |  | ||||||
|  | @ -468,6 +468,8 @@ C-API | ||||||
| Library | Library | ||||||
| ------- | ------- | ||||||
| 
 | 
 | ||||||
|  | - Issue #9128: Fix validation of class decorators in parser module. | ||||||
|  | 
 | ||||||
| - Issue #9094: python -m pickletools will now disassemble pickle files | - Issue #9094: python -m pickletools will now disassemble pickle files | ||||||
|   listed in the command line arguments.  See output of python -m |   listed in the command line arguments.  See output of python -m | ||||||
|   pickletools -h for more details. |   pickletools -h for more details. | ||||||
|  |  | ||||||
|  | @ -2512,10 +2512,11 @@ validate_decorated(node *tree) | ||||||
|     int nch = NCH(tree); |     int nch = NCH(tree); | ||||||
|     int ok = (validate_ntype(tree, decorated) |     int ok = (validate_ntype(tree, decorated) | ||||||
|               && (nch == 2) |               && (nch == 2) | ||||||
|             && validate_decorators(RCHILD(tree, -2)) |               && validate_decorators(RCHILD(tree, -2))); | ||||||
|             && (validate_funcdef(RCHILD(tree, -1)) |     if (TYPE(RCHILD(tree, -1)) == funcdef) | ||||||
|                 || validate_class(RCHILD(tree, -1))) |         ok = ok && validate_funcdef(RCHILD(tree, -1)); | ||||||
|             ); |     else | ||||||
|  |         ok = ok && validate_class(RCHILD(tree, -1)); | ||||||
|     return ok; |     return ok; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mark Dickinson
						Mark Dickinson