Skip to content

Add typing.get_type_hints backport #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cdce8p opened this issue May 24, 2024 · 2 comments
Closed

Add typing.get_type_hints backport #410

cdce8p opened this issue May 24, 2024 · 2 comments

Comments

@cdce8p
Copy link
Contributor

cdce8p commented May 24, 2024

Would it be worth backporting python/cpython#114053 for Python 3.12.0 - 3.12.3?
/CC @AlexWaygood

@AlexWaygood
Copy link
Member

AlexWaygood commented May 24, 2024

IIRC, backporting stuff that involves ForwardRef._evaluate() is pretty hard, because you end up having to copy a huge amount of typing internals into typing_extensions :(

So I'm not sure if it would be worth it just for the early 3.12 patch releases. But I'm definitely open to it if there's a way to do it that's not too fragile or complicated

@AlexWaygood
Copy link
Member

AlexWaygood commented Sep 23, 2024

I'm going to close this for now, as I don't think we have any plans to work on this considering that we think it would be quite involved to implement. However, we do now have typing_extensions.get_annotations(), which does similar things to typing.get_type_hints() without some of the... questionable behaviour that get_type_hints must maintain for backwards compatibility purposes :-)

(And I'd still be happy to review a PR if you can see a way to backport it in a non-horrible way!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants