bpo-34909: keep searching mixins until base class is found (GH-9737)

This commit is contained in:
Ethan Furman 2018-10-05 23:29:36 -07:00 committed by GitHub
parent 92878829c3
commit cd45385ffa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View file

@ -486,7 +486,7 @@ class EnumMeta(type):
if base is object:
continue
elif '__new__' in base.__dict__:
if issubclass(base, Enum) and not hasattr(base, '__new_member__'):
if issubclass(base, Enum):
continue
return base
@ -499,7 +499,6 @@ class EnumMeta(type):
member_type = _find_data_type(bases) or object
if first_enum._member_names_:
raise TypeError("Cannot extend enumerations")
return member_type, first_enum
@staticmethod
@ -545,7 +544,6 @@ class EnumMeta(type):
use_args = False
else:
use_args = True
return __new__, save_new, use_args