diff options
| author | chrysn <chrysn@fsfe.org> | 2024-05-07 10:35:51 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-07 10:35:51 (GMT) |
| commit | 1e428426c836b9a434810a6b99f70454d3a9611e (patch) | |
| tree | a155c5a2f0bef5d89efba434eae0d5b152a254c3 /Lib/enum.py | |
| parent | 6cf70678e2d4126ed921e6288477ebd6889b9af7 (diff) | |
| download | cpython-1e428426c836b9a434810a6b99f70454d3a9611e.zip cpython-1e428426c836b9a434810a6b99f70454d3a9611e.tar.gz cpython-1e428426c836b9a434810a6b99f70454d3a9611e.tar.bz2 | |
gh-118650: Exclude `_repr_*` methods from Enum's _sunder_ reservation (GH-118651)
Diffstat (limited to 'Lib/enum.py')
| -rw-r--r-- | Lib/enum.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 5485306..c36fc75 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -365,7 +365,10 @@ class EnumDict(dict): '_generate_next_value_', '_numeric_repr_', '_missing_', '_ignore_', '_iter_member_', '_iter_member_by_value_', '_iter_member_by_def_', '_add_alias_', '_add_value_alias_', - ): + # While not in use internally, those are common for pretty + # printing and thus excluded from Enum's reservation of + # _sunder_ names + ) and not key.startswith('_repr_'): raise ValueError( '_sunder_ names, such as %r, are reserved for future Enum use' % (key, ) |
