Repository: python/cpython
Pull request: gh-112328: Document EnumDict in docs and release notes
In PR #112514 `EnumDict` was made public but was not documented. This patch adds the documentation.

Resolves #112328 

<!-- gh-issue-number: gh-112328 -->
* Issue: gh-112328
<!-- /gh-issue-number -->


<!-- readthedocs-preview cpython-previews start -->
----
📚 Documentation preview 📚: https://cpython-previews--121720.org.readthedocs.build/

<!-- readthedocs-preview cpython-previews end -->

Problem statement:
[Enum] make some private attributes public
# Feature or enhancement

Make `_EnumDict`, `_EnumDict._member_names`, and possibly other private names public.

This is to make subclassing `EnumType` and other advanced behavior supported, such as having multiple values per member.


<!-- gh-linked-prs -->
### Linked PRs
* gh-112514
* gh-121720
* gh-123669
* gh-128142
<!-- /gh-linked-prs -->

Hints from issue discussion:
The PR has been merged, shall we close this, or is there more to do?
Closing, thanks for the reminder.
`EnumDict` is now public and included in `Enum.__all__`, but it is not documented at https://docs.python.org/3.13/library/enum.html or mentioned in the What's New for 3.13.
I am working on documenting this.

Commit message: Restore deleted EnumType

Patch to review:
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 8b3f397ea862f4..d6f14745bb5fb2 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -64,6 +64,10 @@ are not normal Python classes.  See
 Module Contents
 ---------------
 
+   :class:`EnumDict`
+
+      An enum class :class:`dict` that tracks order and enforces unique member names.
+
    :class:`EnumType`
 
       The ``type`` for Enum and its subclasses.
@@ -159,12 +163,28 @@ Data Types
 ----------
 
 
-.. class:: EnumType
+.. class:: EnumDict
+
+   *EnumDict* is used by *EnumType* to keep track of the enum member orders and prevent reusing the member names.
+
+   .. attribute:: EnumDict.member_names
+
+      Return list of member names.
+
+   .. method:: EnumDict.__setitem__(self, key, value)
+
+      Set any item as an enum member that is not dundered and not a descriptor.
+
+   .. method:: EnumDict.update(self, members, **more_members)
+
+      Update the dictionary from the given iterable or dictionary members and more_members.
 
    *EnumType* is the :term:`metaclass` for *enum* enumerations.  It is possible
    to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-examples>`
    for details.
 
+.. class:: EnumType
+
    ``EnumType`` is responsible for setting the correct :meth:`!__repr__`,
    :meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the
    final *enum*, as well as creating the enum members, properly handling
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 4a9a0b77d068b3..97e64abc9c8beb 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -742,6 +742,11 @@ email
   (Contributed by Thomas Dwyer and Victor Stinner for :gh:`102988` to improve
   the :cve:`2023-27043` fix.)
 
+enum
+----
+
+* :class:`~enum.EnumDict` has been made public in :mod:`enum`.
+
 fractions
 ---------
 


Code review comments:
diff_hunk: @@ -159,12 +163,28 @@ Data Types
 ----------
 
 
-.. class:: EnumType
+.. class:: EnumDict
+
+   *EnumDict* is used by *EnumType* to keep track of the enum member orders and prevent reusing the member names.
+
+   .. attribute:: EnumDict.member_names
+
+      Return list of member names.
+
+   .. method:: EnumDict.__setitem__(self, key, value)
+
+      Set any item as an enum member that is not dundered and not a descriptor.
+
+   .. method:: EnumDict.update(self, members, **more_members)
+
+      Update the dictionary from the given iterable or dictionary members and more_members.
 
    *EnumType* is the :term:`metaclass` for *enum* enumerations.  It is possible
    to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-examples>`
    for details.
 
+.. class:: EnumType
+
path: Doc/library/enum.rst
text: @user1:
Looks like you moved this to the wrong place in the document. Let's restore its original placing:
```suggestion

.. class:: EnumType

   *EnumType* is the :term:`metaclass` for *enum* enumerations.  It is possible
   to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-examples>`
   for details.

```