Resolution of gh-148680 addressed the underlying annotationlib issue without changing the behavior of evaluate_forward_ref.
On 3.14.5:
from annotationlib import Format, get_annotations from typing import TYPE_CHECKING, evaluate_forward_ref def test(arg: Iterable[int]) -> None: pass forward_ref = get_annotations(test, format=Format.FORWARDREF)['arg'] assert forward_ref.evaluate(format=Format.STRING) == 'Iterable[int]' bad_string = evaluate_forward_ref(forward_ref, format=Format.STRING) assert bad_string == 'Iterable[__annotationlib_name_1__]' assert bad_string is forward_ref.__forward_arg__ if TYPE_CHECKING: from collections.abc import Iterable
3.14
macOS
gh-150641: Fix evaluating forward references in STRING format can 'le…
[3.15] gh-150641: Fix evaluating forward references in STRING format …
[3.14] gh-150641: Fix evaluating forward references in STRING format …
Activity
gh-150641: Fix evaluating forward references in STRING format can 'le…
[3.15] gh-150641: Fix evaluating forward references in STRING format …
[3.14] gh-150641: Fix evaluating forward references in STRING format …