Simplify typing.evaluate_forward_ref
#133960
Labels
3.14
bugs and security fixes
3.15
new features, bugs and security fixes
stdlib
Python modules in the Lib dir
topic-typing
type-bug
An unexpected behavior, bug, or error
Bug report
In PEP-749 I added
typing.evaluate_forward_ref
to replace the privatetyping.ForwardRef._evaluate
, which is being used by some external users.The current documentation claims these differences from
annotationlib.ForwardRef.evaluate
:(1) is useful and fits well with the typing module; annotationlib can't do this because it requires introspecting into typing-specific objects. (2) I feel is not useful (compare #133959): the type check is not particularly thorough, and it's generally better for callers to allow more objects through that callers can handle on their own terms. (3) is sort of harmless but not particularly useful. (4) is not true any more since I also added support for these formats to
ForwardRef.evaluate
.So I'd like to drop differences 2 through 4, leaving the function focused on recursively evaluating nested ForwardRefs.
Linked PRs
The text was updated successfully, but these errors were encountered: