From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 24 May 2023 23:35:58 +0000 (-0700) Subject: [3.11] gh-104874: Document NewType.__supertype__ (GH-104875) (#104907) X-Git-Tag: v3.11.4~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b3f2e107b8b53b5feb67ca433bfca4b1d21dedf;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-104874: Document NewType.__supertype__ (GH-104875) (#104907) gh-104874: Document NewType.__supertype__ (GH-104875) (cherry picked from commit 41768a2bd3a8f57e6ce4e4ae9cab083b69817ec1) Co-authored-by: Jelle Zijlstra --- diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 33cf1cb8fdfe..bcf30c50d50b 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1628,6 +1628,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 000000000000..9d5904bc1464 --- /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.