From ff6d08499517033e96ddf7a33ab679de56c8c323 Mon Sep 17 00:00:00 2001 From: Andrew <62027275+aresler@users.noreply.github.com> Date: Wed, 29 Dec 2021 19:58:42 +0300 Subject: [PATCH] Fix NamedTuple._field_types for python > 3.9 (#6728) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Akuli --- stdlib/typing.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index c3a7043f9..b4817f93f 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -682,7 +682,10 @@ def cast(typ: object, val: Any) -> Any: ... # Type constructors class NamedTuple(Tuple[Any, ...]): - _field_types: collections.OrderedDict[str, Type[Any]] + if sys.version_info < (3, 8): + _field_types: collections.OrderedDict[str, type] + elif sys.version_info < (3, 9): + _field_types: dict[str, type] _field_defaults: dict[str, Any] _fields: Tuple[str, ...] _source: str