Open
Description
There are various places in the stdlib where we access the .__annotations__
attribute. Under PEP-649 / PEP-749, this now forces evaluation of lazy annotations. We should avoid evaluating annotations where it is not necessary.
For example, currently typing.Protocol
evaluates its annotations at protocol creation time.
Linked PRs
- gh-132493: Support deferred annotations in Protocols #132494
- gh-132493: lazy evaluation of annotations in
typing._proto_hook
#132534 - gh-132493: Avoid eager import of annotationlib in typing (again) #132596
- gh-132493: Avoid eager evaluation of annotations in
@reprlib.recursive_repr()
#133411 - gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike #133415
- [3.14] gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415) #133796
Metadata
Metadata
Assignees
Labels
bugs and security fixesbugs and security fixesPython modules in the Lib dirPython modules in the Lib dirAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error