[3.14] gh-138891: fix star-unpack in get_annotations (GH-138951) (#140384)

gh-138891: fix star-unpack in get_annotations (GH-138951)
(cherry picked from commit c6be6e4537)

Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
This commit is contained in:
Miss Islington (bot) 2025-10-20 22:20:47 +02:00 committed by GitHub
parent 8e93f6e203
commit 62f44dda1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 9 deletions

View file

@ -787,6 +787,12 @@ def test_stringized_annotations_in_empty_module(self):
self.assertEqual(get_annotations(isa2, eval_str=True), {})
self.assertEqual(get_annotations(isa2, eval_str=False), {})
def test_stringized_annotations_with_star_unpack(self):
def f(*args: *tuple[int, ...]): ...
self.assertEqual(get_annotations(f, eval_str=True),
{'args': (*tuple[int, ...],)[0]})
def test_stringized_annotations_on_wrapper(self):
isa = inspect_stringized_annotations
wrapped = times_three(isa.function)