From 786d97a66cac48e7a933010367b8993a5b3ab85b Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Thu, 24 Dec 2020 19:31:10 -0800 Subject: [PATCH] bpo-42727: [Enum] use super() and include **kwds (GH-23927) for multiple inheritance support: use super().new pass **kwds to super().new --- Lib/enum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/enum.py b/Lib/enum.py index 36a9a400a11..75249bfdc1b 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -235,10 +235,10 @@ class EnumMeta(type): # create our new Enum type if bases: bases = (_NoInitSubclass, ) + bases - enum_class = type.__new__(metacls, cls, bases, classdict) + enum_class = super().__new__(metacls, cls, bases, classdict, **kwds) enum_class.__bases__ = enum_class.__bases__[1:] #or (object, ) else: - enum_class = type.__new__(metacls, cls, bases, classdict) + enum_class = super().__new__(metacls, cls, bases, classdict, **kwds) old_init_subclass = getattr(enum_class, '__init_subclass__', None) # and restore the new one (if there was one) if new_init_subclass is not None: