mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +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 @@ class ExceptionTests(unittest.TestCase):
|
|||
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