diff --git a/proto/enums.py b/proto/enums.py index 6207ad7..769b6d8 100644 --- a/proto/enums.py +++ b/proto/enums.py @@ -74,7 +74,7 @@ def __new__(mcls, name, bases, attrs): descriptor_pb2.EnumValueDescriptorProto(name=name, number=number) # Minor hack to get all the enum variants out. for name, number in attrs.items() - if isinstance(number, int) + if name in attrs._member_names and isinstance(number, int) ), key=lambda v: v.number, ),