mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
Close issue23900: add default __doc__ to new enumerations that do not specify one.
This commit is contained in:
parent
a1c7e727c8
commit
48a724fa33
2 changed files with 9 additions and 5 deletions
|
@ -106,6 +106,10 @@ class EnumMeta(type):
|
|||
raise ValueError('Invalid enum member name: {0}'.format(
|
||||
','.join(invalid_names)))
|
||||
|
||||
# create a default docstring if one has not been provided
|
||||
if '__doc__' not in classdict:
|
||||
classdict['__doc__'] = 'An enumeration.'
|
||||
|
||||
# create our new Enum type
|
||||
enum_class = super().__new__(metacls, cls, bases, classdict)
|
||||
enum_class._member_names_ = [] # names in definition order
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue