summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2024-03-05 09:14:18 (GMT)
committerGitHub <noreply@github.com>2024-03-05 09:14:18 (GMT)
commita29998a06bf75264c3faaeeec4584a5f75b45a1f (patch)
tree75d9bd8f575bb217df23f948564a1fe39e76e862 /Lib/test
parentffcc450a9b8b6927549b501eff7ac14abc238448 (diff)
downloadcpython-a29998a06bf75264c3faaeeec4584a5f75b45a1f.zip
cpython-a29998a06bf75264c3faaeeec4584a5f75b45a1f.tar.gz
cpython-a29998a06bf75264c3faaeeec4584a5f75b45a1f.tar.bz2
gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty string arg (#116341)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_typing.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index dbbbe63..912384a 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -5867,6 +5867,12 @@ class ForwardRefTests(BaseTestCase):
with self.assertRaises(SyntaxError):
get_type_hints(foo)
+ def test_syntax_error_empty_string(self):
+ for form in [typing.List, typing.Set, typing.Type, typing.Deque]:
+ with self.subTest(form=form):
+ with self.assertRaises(SyntaxError):
+ form['']
+
def test_name_error(self):
def foo(a: 'Noode[T]'):