mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
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:
parent
0705ec8a14
commit
3064dbf5df
3 changed files with 18 additions and 5 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue