From d3d08f6e4cae5dba2911d7c8b2290e120420a697 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 19 Dec 2022 12:40:37 -0500 Subject: [PATCH] Fix python3.11 breaking change --- enumfields/enums.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/enumfields/enums.py b/enumfields/enums.py index 1da3a1d..73f9842 100644 --- a/enumfields/enums.py +++ b/enumfields/enums.py @@ -14,7 +14,10 @@ def __new__(mcs, name, bases, attrs): if Labels is not None and inspect.isclass(Labels): del attrs['Labels'] if hasattr(attrs, '_member_names'): - attrs._member_names.remove('Labels') + if sys.version_info >= (3, 11, 0): + del attrs._member_names['Labels'] + else: + attrs._member_names.remove('Labels') if sys.version_info >= (3, 9, 2): attrs._cls_name = name