diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-12-25 08:07:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-25 08:07:30 -0800 |
commit | fbffda25b4b5f537e651eaab4ca1ec4cde800709 (patch) | |
tree | b054bdf1899ed0a623bfa94b012758a0a9a33493 | |
parent | 51f502914656a1f8e8ffdf6e1b06f670d8fea8ed (diff) | |
download | cpython-git-fbffda25b4b5f537e651eaab4ca1ec4cde800709.tar.gz |
bpo-42727: [Enum] use super() and include **kwds (GH-23927)
for multiple inheritance support:
use super().new
pass **kwds to super().new
(cherry picked from commit 786d97a66cac48e7a933010367b8993a5b3ab85b)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
-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 aa9f4b00dd..1c22380f03 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -227,10 +227,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: |