-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixestopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
import annotationlib
def f(self, *args: ' *tuple[str, int]') -> None: ...
print(annotationlib.get_annotations(f, eval_str=True))Expected:
{'args': *tuple[str, int], 'return': None}Got:
Traceback (most recent call last):
File "/home/bswck/Python/cpython/t.py", line 5, in <module>
print(annotationlib.get_annotations(f, eval_str=True))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/bswck/Python/cpython/Lib/annotationlib.py", line 1058, in get_annotations
else eval(_rewrite_star_unpack(value), globals, locals)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 1
*tuple[str, int]
^
SyntaxError: invalid syntax
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixestopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error