[issue41517] Enum multiple inheritance loophole

Tal Suhareanu report at bugs.python.org
Mon Aug 10 15:24:02 EDT 2020


Tal Suhareanu <talsuk5 at gmail.com> added the comment:

sorry, I'll explain. by "when inheriting an implemented enum, we get a runtime error" I refer to this https://docs.python.org/3/library/enum.html#restricted-enum-subclassing

You shouldn't be able to subclass an enum, yet I just showed a loophole. my example code shows you can subclass an enum by using a trick, multiple inheritance.

I hope it's more clear now :)

btw it also works with regular Enum inheritance (I just used IntEnum for simplicity)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41517>
_______________________________________


More information about the Python-bugs-list mailing list