Skip to content
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

[3.10] bpo-41249: Fix postponed annotations for TypedDict (GH-27017) #27204

Merged
merged 1 commit into from
Jul 17, 2021

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 17, 2021

This fixes TypedDict to work with get_type_hints and postponed evaluation of annotations across modules.

This is done by adding the module name to ForwardRef at the time the object is created and using that to resolve the globals during the evaluation.

Co-authored-by: Ken Jin 28750310+Fidget-Spinner@users.noreply.github.com
(cherry picked from commit 889036f)

Co-authored-by: Germán Méndez Bravo german.mb@gmail.com

https://bugs.python.org/issue41249

This fixes TypedDict to work with get_type_hints and postponed evaluation of annotations across modules.

This is done by adding the module name to ForwardRef at the time the object is created and using that to resolve the globals during the evaluation.

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 889036f)

Co-authored-by: Germán Méndez Bravo <german.mb@gmail.com>
@ambv ambv merged commit 480f29f into python:3.10 Jul 17, 2021
@bedevere-bot
Copy link

@ambv: Please replace # with GH- in the commit message next time. Thanks!

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

Successfully merging this pull request may close these issues.

6 participants