]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104874: Document NewType.__supertype__ (#104875)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Wed, 24 May 2023 23:23:28 +0000 (16:23 -0700)
committerGitHub <noreply@github.com>
Wed, 24 May 2023 23:23:28 +0000 (00:23 +0100)
Doc/library/typing.rst
Misc/NEWS.d/next/Library/2023-05-24-09-34-23.gh-issue-104874.oqyJSy.rst [new file with mode: 0644]

index 92943c46ef5132fceb1ce13b9a0898dc59c55d4c..df16c31c43f53e85af894a1d82c334abe3ab58df 100644 (file)
@@ -1648,6 +1648,18 @@ These are not used in annotations. They are building blocks for declaring types.
       UserId = NewType('UserId', int)
       first_user = UserId(1)
 
+   .. attribute:: __module__
+
+      The module in which the new type is defined.
+
+   .. attribute:: __name__
+
+      The name of the new type.
+
+   .. attribute:: __supertype__
+
+      The type that the new type is based on.
+
    .. versionadded:: 3.5.2
 
    .. versionchanged:: 3.10
diff --git a/Misc/NEWS.d/next/Library/2023-05-24-09-34-23.gh-issue-104874.oqyJSy.rst b/Misc/NEWS.d/next/Library/2023-05-24-09-34-23.gh-issue-104874.oqyJSy.rst
new file mode 100644 (file)
index 0000000..9d5904b
--- /dev/null
@@ -0,0 +1,2 @@
+Document the ``__name__`` and ``__supertype__`` attributes of
+:class:`typing.NewType`. Patch by Jelle Zijlstra.