aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2020-12-07 00:17:31 -0800
committerGitHub <noreply@github.com>2020-12-07 00:17:31 -0800
commitc266736ec1f9ebef38b134ceb4832df015711b38 (patch)
tree11828a60f85d516791d4d3309d6217a7d047405d /Lib/enum.py
parent212337369a64aa96d8b370f39b70113078ad0020 (diff)
downloadcpython-c266736ec1f9ebef38b134ceb4832df015711b38.tar.gz
cpython-c266736ec1f9ebef38b134ceb4832df015711b38.zip
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487)
Diffstat (limited to 'Lib/enum.py')
-rw-r--r--Lib/enum.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/enum.py b/Lib/enum.py
index 40ff25b9cda..d670ad7d861 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -146,8 +146,9 @@ class EnumMeta(type):
for key in ignore:
classdict.pop(key, None)
member_type, first_enum = metacls._get_mixins_(cls, bases)
- __new__, save_new, use_args = metacls._find_new_(classdict, member_type,
- first_enum)
+ __new__, save_new, use_args = metacls._find_new_(
+ classdict, member_type, first_enum,
+ )
# save enum items into separate mapping so they don't get baked into
# the new class
@@ -501,12 +502,16 @@ class EnumMeta(type):
for base in chain.__mro__:
if base is object:
continue
+ elif issubclass(base, Enum):
+ if base._member_type_ is not object:
+ data_types.append(base._member_type_)
+ break
elif '__new__' in base.__dict__:
if issubclass(base, Enum):
continue
data_types.append(candidate or base)
break
- elif not issubclass(base, Enum):
+ else:
candidate = base
if len(data_types) > 1:
raise TypeError('%r: too many data types: %r' % (class_name, data_types))