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:
Serhiy Storchaka 2018-11-27 09:40:29 +02:00 committed by GitHub
parent d1cbc6f8a0
commit b619b09792
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 278 additions and 230 deletions

View file

@ -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)