From 74747ee52cf8add26853bb94a3da754e05fbfd46 Mon Sep 17 00:00:00 2001 From: Dmitri-Minkin Date: Wed, 27 Nov 2024 12:51:11 -0500 Subject: [PATCH] fix: enums initialization in PyPy When removing the _pb_options name from the enum attributes, enums initialization in PyPy should not raise exception. Refs: #506 --- proto/enums.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proto/enums.py b/proto/enums.py index 4073c2a..d3ab6b7 100644 --- a/proto/enums.py +++ b/proto/enums.py @@ -61,6 +61,8 @@ def __new__(mcls, name, bases, attrs): if isinstance(attrs._member_names, list): idx = attrs._member_names.index(pb_options) attrs._member_names.pop(idx) + elif isinstance(attrs._member_names, set): # PyPy + attrs._member_names.discard(pb_options) else: # Python 3.11.0b3 del attrs._member_names[pb_options]