bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463)
(cherry picked from commit 6fa8b2ceee38187b0ae96aee12fe4f0a5c8a2ce7)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index cc0640d..86b5dcc 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -266,6 +266,18 @@ def baz():
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)