summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-05-24 23:23:28 (GMT)
committerGitHub <noreply@github.com>2023-05-24 23:23:28 (GMT)
commit41768a2bd3a8f57e6ce4e4ae9cab083b69817ec1 (patch)
treefe80a457201879bc9fa7e4dbb13b2d215dda14bb
parentdbcdbf1814b3df4c4e08e525b03384376598217d (diff)
downloadcpython-41768a2bd3a8f57e6ce4e4ae9cab083b69817ec1.zip
cpython-41768a2bd3a8f57e6ce4e4ae9cab083b69817ec1.tar.gz
cpython-41768a2bd3a8f57e6ce4e4ae9cab083b69817ec1.tar.bz2
gh-104874: Document NewType.__supertype__ (#104875)
-rw-r--r--Doc/library/typing.rst12
-rw-r--r--Misc/NEWS.d/next/Library/2023-05-24-09-34-23.gh-issue-104874.oqyJSy.rst2
2 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 92943c4..df16c31 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -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
index 0000000..9d5904b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-05-24-09-34-23.gh-issue-104874.oqyJSy.rst
@@ -0,0 +1,2 @@
+Document the ``__name__`` and ``__supertype__`` attributes of
+:class:`typing.NewType`. Patch by Jelle Zijlstra.