mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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 3064dbf5df
)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
This commit is contained in:
parent
6a39888c2c
commit
48f99250ff
3 changed files with 18 additions and 5 deletions
|
@ -1001,6 +1001,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