From fd9439e87ae71fa027ab2a8d8af7e9cf28c7d825 Mon Sep 17 00:00:00 2001 From: johnslavik Date: Sun, 11 Jan 2026 18:14:01 +0100 Subject: [PATCH 1/3] Keep `TypedDict` and `NamedTuple` in `class` role in docs Partially reverts GH-143692; see https://github.com/python/cpython/pull/143692#issuecomment-3735057203 --- Doc/library/typing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 73236413cbb80f..eaa0ba54af18e7 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2369,7 +2369,7 @@ These functions and classes should not be used directly as annotations. Their intended purpose is to be building blocks for creating and declaring types. -.. function:: NamedTuple +.. class:: NamedTuple Typed version of :func:`collections.namedtuple`. @@ -2589,7 +2589,7 @@ types. for more details. -.. function:: TypedDict +.. class:: TypedDict(dict) Special construct to add type hints to a dictionary. At runtime ":class:`!TypedDict` instances" are simply :class:`dicts `. From c323af944d4bbe48dd6424ac51e336f450fdd4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20S=C5=82awecki?= Date: Sun, 11 Jan 2026 18:22:26 +0100 Subject: [PATCH 2/3] Don't revert for `NamedTuple` --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index eaa0ba54af18e7..d4c0bcdbed706c 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2369,7 +2369,7 @@ These functions and classes should not be used directly as annotations. Their intended purpose is to be building blocks for creating and declaring types. -.. class:: NamedTuple +.. function:: NamedTuple Typed version of :func:`collections.namedtuple`. From 42447453e882188831b22122ada3291ff986d46b Mon Sep 17 00:00:00 2001 From: johnslavik Date: Sun, 11 Jan 2026 18:30:58 +0100 Subject: [PATCH 3/3] Revert "Don't revert for `NamedTuple`" This reverts commit c323af944d4bbe48dd6424ac51e336f450fdd4ef. --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index d4c0bcdbed706c..eaa0ba54af18e7 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2369,7 +2369,7 @@ These functions and classes should not be used directly as annotations. Their intended purpose is to be building blocks for creating and declaring types. -.. function:: NamedTuple +.. class:: NamedTuple Typed version of :func:`collections.namedtuple`.