]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-41249: Fix postponed annotations for TypedDict (GH-27017) (GH-27205)
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Sat, 17 Jul 2021 09:36:38 +0000 (17:36 +0800)
committerGitHub <noreply@github.com>
Sat, 17 Jul 2021 09:36:38 +0000 (11:36 +0200)
commitfa674bdea3bbb20ad6ccd95b3849fc4995bc37e0
tree9e600b32da4dbe1778c75a618783b883cc5c422f
parentdf7c62980d15acd3125dfbd81546dad359f7add7
[3.9] bpo-41249: Fix postponed annotations for TypedDict (GH-27017) (GH-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>
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]