diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-09-16 14:30:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-16 14:30:54 (GMT) |
commit | 3f4012117bf80aa7c005f8fa6fb8e1f8b1aef5d5 (patch) | |
tree | 4d549f20692e4e5bc3eb3b4dbe12555aaa0b2687 /Lib/test | |
parent | 929112ef81ccef20d3aef25c8a1142059ee941da (diff) | |
download | cpython-3f4012117bf80aa7c005f8fa6fb8e1f8b1aef5d5.zip cpython-3f4012117bf80aa7c005f8fa6fb8e1f8b1aef5d5.tar.gz cpython-3f4012117bf80aa7c005f8fa6fb8e1f8b1aef5d5.tar.bz2 |
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>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_enum.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 32ff32c..11e88db 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -1000,6 +1000,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): |