[issue41517] Enum multiple inheritance loophole
New submission from Tal Suhareanu : when inheriting an implemented enum, we get a runtime error But when creating a multiple inheritance like the following, it works… so something feels broken in the enum mechanism from enum import IntEnum, Enum class A(IntEnum): a = 1 class B(A, Enum): b= 1 print(B.b) -- components: Library (Lib) messages: 375133 nosy: talsuk5 priority: normal severity: normal status: open title: Enum multiple inheritance loophole type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue41517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41517] Enum multiple inheritance loophole
Tal Suhareanu added the comment: Eric V. Smith it's in the first comment -- ___ Python tracker <https://bugs.python.org/issue41517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41517] Enum multiple inheritance loophole
Tal Suhareanu 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 <https://bugs.python.org/issue41517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41517] Enum multiple inheritance loophole
Tal Suhareanu added the comment: Ethan Furman bullseye! thanks for clarifying -- ___ Python tracker <https://bugs.python.org/issue41517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com