bpo-41517: do not allow Enums to be extended (#22271)

fix bug that let Enums be extended via multiple inheritance
This commit is contained in:
Ethan Furman 2020-09-16 07:11:57 -07:00 committed by GitHub
parent 0705ec8a14
commit 3064dbf5df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 5 deletions

View file

@ -1009,6 +1009,9 @@ class TestEnum(unittest.TestCase):
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):