# Feature or enhancement ### Proposal: `annotationlib` implements an optimization to resolve forward references in `ForwardRef.evaluate()`, by doing a simple lookup in the namespace: https://github.com/python/cpython/blob/112560ee34a70c02baebdc11519d1f77e90ecab8/Lib/annotationlib.py#L193-L210 This gives slightly inconsistent results with lazy imports that fail to resolve: ```python # lazy_mod.py Alias = list raise Exception() ``` ```python from annotationlib import Format, get_annotations lazy from lazy_mod import Alias class A: a: Alias class B: a: Alias[int] get_annotations(A, format=Format.FORWARDREF) #> {'a': <lazy_import 'failing_mod.Alias'>} get_annotations(B, format=Format.FORWARDREF) #> {'a': ForwardRef('Alias[int]', is_class=True, owner=<class '__main__.B'>)} ``` I'm wondering if for `A`, it should instead wrap `a`'s annotation in a `ForwardRef`, so that users can then call `evaluate()` on it (e.g. with `Format.VALUE`) so that the exception from `lazy_mod` gets raised accordingly. Alternatively, the lazy import instance could be kept as is, but it would be great to document the `resolve()` method on [`types.LazyImportType`](https://docs.python.org/3.15/library/types.html#types.LazyImportType). ### Has this already been discussed elsewhere? This is a minor feature, which does not need previous discussion elsewhere ### Links to previous discussion of this feature: _No response_ <!-- gh-linked-prs --> ### Linked PRs * gh-156940 <!-- /gh-linked-prs -->