◐ Shell
clean mode source ↗

bpo-41249: Fix postponed annotations for TypedDict by Kronuz · Pull Request #27017 · python/cpython

Fidget-Spinner

Fidget-Spinner

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

Fidget-Spinner

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>

gvanrossum

@Kronuz

septatrix

@Kronuz

gvanrossum

@gvanrossum

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

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>

Fidget-Spinner added a commit to Fidget-Spinner/cpython that referenced this pull request

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>

ambv pushed a commit that referenced this pull request

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>

ambv added a commit that referenced this pull request

Jul 17, 2021
…H-27205)

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>
Co-authored-by: Germán Méndez Bravo <german.mb@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>