diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2020-12-25 03:31:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-25 03:31:10 (GMT) |
commit | 786d97a66cac48e7a933010367b8993a5b3ab85b (patch) | |
tree | 4256e31a21b17a5ba218a0ddf2b39e097f2c58bc /Lib/enum.py | |
parent | c6c43b28746b0642cc3c49dd8138b896bed3028f (diff) | |
download | cpython-786d97a66cac48e7a933010367b8993a5b3ab85b.zip cpython-786d97a66cac48e7a933010367b8993a5b3ab85b.tar.gz cpython-786d97a66cac48e7a933010367b8993a5b3ab85b.tar.bz2 |
bpo-42727: [Enum] use super() and include **kwds (GH-23927)
for multiple inheritance support:
use super().new
pass **kwds to super().new
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 36a9a40..75249bf 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: |