mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-31241: Fix AST node position for list and generator comprehensions. (GH-10633)
The lineno and col_offset attributes of AST nodes for list comprehensions, generator expressions and tuples are now point to the opening parenthesis or square brace. For tuples without parenthesis they point to the position of the first item.
This commit is contained in:
		
							parent
							
								
									d1cbc6f8a0
								
							
						
					
					
						commit
						b619b09792
					
				
					 5 changed files with 278 additions and 230 deletions
				
			
		|  | @ -204,7 +204,7 @@ def check(src, lineno, offset): | |||
|         check('x = 0o9', 1, 6) | ||||
| 
 | ||||
|         # Errors thrown by symtable.c | ||||
|         check('x = [(yield i) for i in range(3)]', 1, 6) | ||||
|         check('x = [(yield i) for i in range(3)]', 1, 5) | ||||
|         check('def f():\n  from _ import *', 1, 1) | ||||
|         check('def f(x, x):\n  pass', 1, 1) | ||||
|         check('def f(x):\n  nonlocal x', 2, 3) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka