PEP 649: Deferred evaluation of annotations, tentatively accepted

Yes, that’s awkward and you’d probably need to branch on sys.version_info right now. inspect.get_annotations abstracts this away, but it was added in 3.10. Though it’s worth noting that Python 3.9 reaches its EOL in October 2025, which is also when Python 3.14 (which is where PEP 649 would be implemented) should be released.

We could backport inspect.get_annotations in typing_extensions to make this easier.

4 Likes