8000 gh-118650: Exclude `_repr_*` methods from Enum's _sunder_ reservation · python/cpython@3651668 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3651668

Browse files
committed
gh-118650: Exclude _repr_* methods from Enum's _sunder_ reservation
1 parent c3f4a6b commit 3651668

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/enum.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ def __setitem__(self, key, value):
365365
'_generate_next_value_', '_numeric_repr_', '_missing_', '_ignore_',
366366
'_iter_member_', '_iter_member_by_value_', '_iter_member_by_def_',
367367
'_add_alias_', '_add_value_alias_',
368-
):
368+
# While not in use internally, those are common for pretty
369+
# printing and thus excluded from Enum's reservation of
370+
# _sunder_ names
371+
) and not key.startswith('_repr_'):
369372
raise ValueError(
370373
'_sunder_ names, such as %r, are reserved for future Enum use'
371374
% (key, )

0 commit comments

Comments
 (0)
0