]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41249: Fix postponed annotations for TypedDict (GH-27017)
authorGermán Méndez Bravo <german.mb@gmail.com>
Sat, 17 Jul 2021 03:49:30 +0000 (20:49 -0700)
committerGitHub <noreply@github.com>
Sat, 17 Jul 2021 03:49:30 +0000 (20:49 -0700)
commit889036f7ef7290ef15b6c3373023f6a35387af0c
tree9e9f518eaaba90dd211473bc917b9938f4144fb9
parentbf89ff96e6ba21bb52b8597b5e51e8ffc57e6589
bpo-41249: Fix postponed annotations for TypedDict (GH-27017)

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>
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]