mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the barry_as_flufl rule (GH-23048)
This commit is contained in:
		
							parent
							
								
									6e03c0ad15
								
							
						
					
					
						commit
						06f8c3328d
					
				
					 6 changed files with 23 additions and 5 deletions
				
			
		|  | @ -955,6 +955,23 @@ def test_nested_named_except_blocks(self): | |||
|         code += f"{' '*4*12}pass" | ||||
|         self._check_error(code, "too many statically nested blocks") | ||||
| 
 | ||||
|     def test_barry_as_flufl_with_syntax_errors(self): | ||||
|         # The "barry_as_flufl" rule can produce some "bugs-at-a-distance" if | ||||
|         # is reading the wrong token in the presence of syntax errors later | ||||
|         # in the file. See bpo-42214 for more information. | ||||
|         code = """ | ||||
| def func1(): | ||||
|     if a != b: | ||||
|         raise ValueError | ||||
| 
 | ||||
| def func2(): | ||||
|     try | ||||
|         return 1 | ||||
|     finally: | ||||
|         pass | ||||
| """ | ||||
|         self._check_error(code, "invalid syntax") | ||||
| 
 | ||||
| def test_main(): | ||||
|     support.run_unittest(SyntaxTestCase) | ||||
|     from test import test_syntax | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pablo Galindo
						Pablo Galindo