]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-139398: [Enum] Add supported sunder names to `__dir__` for REPL completions (GH...
authorRafael Weingartner-Ortner <38643099+RafaelWO@users.noreply.github.com>
Thu, 28 May 2026 19:55:38 +0000 (21:55 +0200)
committerGitHub <noreply@github.com>
Thu, 28 May 2026 19:55:38 +0000 (12:55 -0700)
commitbaf11a4e9a9d6542a1f3a891c670da36c89cbc96
treea6329d8ae369800d22c38674e4043febd7766347
parentef2246f788832a64ba7c5215c8e72f8e539e59b4
gh-139398: [Enum] Add supported sunder names to `__dir__` for REPL completions (GH-139985)

* Add supported sunder names to Enum `__dir__`

This change adds the sunder names `_generate_next_value_`
and `_missing_` to the `__dir__` method of `EnumType` and `Enum`.
In Addition, The instance level sunder names
`_add_alias_` and `_add_value_alias_` are added to `Enum.__dir__`.

With the sunder names exposed in the `dir()` method,
the REPL autocomplete will also show them.

---------

Co-authored-by: SimonGPrs <107691772+SimonGPrs@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Doc/library/enum.rst
Lib/enum.py
Lib/test/test_enum.py
Misc/NEWS.d/next/Library/2025-10-12-08-46-26.gh-issue-139398.hESOMl.rst [new file with mode: 0644]