[3.13] gh-126139: Improve error message location for future statement with unknown feature (GH-126140) (#126155)

gh-126139: Improve error message location for future statement with unknown feature (GH-126140)
(cherry picked from commit 224c370a36)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-10-30 01:36:06 +01:00 committed by GitHub
parent f37ac53cd3
commit b9cbc58e13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 8 deletions

View file

@ -319,8 +319,8 @@ class ExceptionTests(unittest.TestCase):
check('def f():\n global x\n nonlocal x', 2, 3)
# Errors thrown by future.c
check('from __future__ import doesnt_exist', 1, 1)
check('from __future__ import braces', 1, 1)
check('from __future__ import doesnt_exist', 1, 24)
check('from __future__ import braces', 1, 24)
check('x=1\nfrom __future__ import division', 2, 1)
check('foo(1=2)', 1, 5)
check('def f():\n x, y: int', 2, 3)