3.14: add annotationlib, update typing and inspect (#13985)

This commit is contained in:
Jelle Zijlstra
2025-05-10 14:25:06 -07:00
committed by GitHub
parent 8bd5455b32
commit 5ff32f377c
10 changed files with 488 additions and 477 deletions
+11
View File
@@ -367,3 +367,14 @@ else:
from enum import Enum
class StrEnum(str, Enum): ...
# Objects that appear in annotations or in type expressions.
# Similar to PEP 747's TypeForm but a little broader.
AnnotationForm: TypeAlias = Any
if sys.version_info >= (3, 14):
from annotationlib import Format
# These return annotations, which can be arbitrary objects
AnnotateFunc: TypeAlias = Callable[[Format], dict[str, AnnotationForm]]
EvaluateFunc: TypeAlias = Callable[[Format], AnnotationForm]