]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41249: Fix postponed annotations for TypedDict (GH-27017) (#27204)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 17 Jul 2021 08:48:17 +0000 (01:48 -0700)
committerGitHub <noreply@github.com>
Sat, 17 Jul 2021 08:48:17 +0000 (10:48 +0200)
commit480f29f913cff30329e7b425fd6669f83d6d8af8
tree75e7e1eca5c266feaa015919aba0611e725d0f08
parentefda9054b9fc91e69ecb34eae84fdd2ca8e6feef
bpo-41249: Fix postponed annotations for TypedDict (GH-27017) (#27204)

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 889036f7ef7290ef15b6c3373023f6a35387af0c)

Co-authored-by: Germán Méndez Bravo <german.mb@gmail.com>
Lib/test/_typed_dict_helper.py [new file with mode: 0644]
Lib/test/test_typing.py
Lib/typing.py
Misc/NEWS.d/next/Library/2021-07-04-11-33-34.bpo-41249.sHdwBE.rst [new file with mode: 0644]