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.9] bpo-41249: Fix postponed annotations for TypedDict (GH-27017) #27205

Merged
merged 2 commits into from Jul 17, 2021

Conversation

@Fidget-Spinner
Copy link
Contributor

@Fidget-Spinner Fidget-Spinner 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>
Copy link
Member

@gvanrossum gvanrossum left a comment

Yeah!

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Jul 17, 2021

Oh wait, test_typing failed!

Lib/test/test_typing.py Outdated Show resolved Hide resolved
@ambv ambv merged commit fa674bd into python:3.9 Jul 17, 2021
14 checks passed
@Fidget-Spinner Fidget-Spinner deleted the backport-41249-3.9 branch Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants