From de2393a8def6f990896d7c6cc823ff190f492ecb Mon Sep 17 00:00:00 2001 From: Philipp A Date: Fri, 26 Apr 2024 16:06:53 +0200 Subject: [PATCH 1/2] [3.12] Fix note in Enum.__new__ docs (GH-118284) (cherry picked from commit 5a4d3df2fa02409ffd2a90cd75b67370206e9891) Co-authored-by: Philipp A --- Doc/library/enum.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index bc5b3d7cd4c095..4cf0f69caff607 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -269,7 +269,7 @@ Data Types >>> Color.RED.value 1 - Value of the member, can be set in :meth:`~object.__new__`. + Value of the member, can be set in :meth:`~Enum.__new__`. .. note:: Enum member values @@ -289,7 +289,7 @@ Data Types .. attribute:: Enum._value_ - Value of the member, can be set in :meth:`~object.__new__`. + Value of the member, can be set in :meth:`~Enum.__new__`. .. attribute:: Enum._order_ @@ -397,8 +397,8 @@ Data Types results in the call ``int('1a', 16)`` and a value of ``17`` for the member. - ..note:: When writing a custom ``__new__``, do not use ``super().__new__`` -- - call the appropriate ``__new__`` instead. + .. note:: When writing a custom ``__new__``, do not use ``super().__new__`` -- + call the appropriate ``__new__`` instead. .. method:: Enum.__repr__(self) From b52eeef6c4cb294b4b7aa33736bad0ad5985969d Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 26 Apr 2024 07:21:43 -0700 Subject: [PATCH 2/2] One more --- Doc/library/enum.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 4cf0f69caff607..faeb94d66069f0 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -817,7 +817,7 @@ Supported ``__dunder__`` names :attr:`~EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member`` items. It is only available on the class. -:meth:`~object.__new__`, if specified, must create and return the enum members; it is +:meth:`~Enum.__new__`, if specified, must create and return the enum members; it is also a very good idea to set the member's :attr:`!_value_` appropriately. Once all the members are created it is no longer used.