bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463)

(cherry picked from commit 6fa8b2ceee)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-01-11 08:33:08 -08:00 committed by GitHub
parent 4cfb10979d
commit 19a85501ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 5 deletions

View file

@ -266,6 +266,18 @@ class ExceptionTests(unittest.TestCase):
check("(1+)", 1, 4)
check("[interesting\nfoo()\n", 1, 1)
check(b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n", 0, -1)
check("""f'''
{
(123_a)
}'''""", 3, 17)
check("""f'''
{
f\"\"\"
{
(123_a)
}
\"\"\"
}'''""", 5, 17)
# Errors thrown by symtable.c
check('x = [(yield i) for i in range(3)]', 1, 7)