bpo-41517: do not allow Enums to be extended (GH-22271)
fix bug that let Enums be extended via multiple inheritance
(cherry picked from commit 3064dbf5df1021e85b507366a7ea448c8895efe7)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 0983513..0ecf641 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -1001,6 +1001,9 @@
cyan = 4
magenta = 5
yellow = 6
+ with self.assertRaisesRegex(TypeError, "EvenMoreColor: cannot extend enumeration 'Color'"):
+ class EvenMoreColor(Color, IntEnum):
+ chartruese = 7
def test_exclude_methods(self):
class whatever(Enum):