From: Ethan Furman Date: Sun, 1 May 2016 17:03:53 +0000 (-0700) Subject: issue26893: use mro() to examine class heirarchy X-Git-Tag: v3.6.0a1~87^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3803ad47bb443d9cad83fe968b1b82ad5bcb75f2;p=thirdparty%2FPython%2Fcpython.git issue26893: use mro() to examine class heirarchy --- diff --git a/Lib/enum.py b/Lib/enum.py index 246df17b9497..b8787d19b884 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -118,7 +118,7 @@ class EnumMeta(type): # save attributes from super classes so we know if we can take # the shortcut of storing members in the class dict - base_attributes = {a for b in bases for a in b.__dict__} + base_attributes = {a for b in enum_class.mro() for a in b.__dict__} # Reverse value->name map for hashable values. enum_class._value2member_map_ = {} diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index a59a04943407..4b14e7f013bf 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -1568,6 +1568,19 @@ class TestUnique(unittest.TestCase): triple = 3 turkey = 3 + def test_unique_with_name(self): + @unique + class Silly(Enum): + one = 1 + two = 'dos' + name = 3 + @unique + class Sillier(IntEnum): + single = 1 + name = 2 + triple = 3 + value = 4 + expected_help_output_with_docs = """\ Help on class Color in module %s: