From de36e3c162707bf0e376d90774d31c13a54eedae Mon Sep 17 00:00:00 2001 From: Catherine Date: Tue, 28 Feb 2023 13:26:52 +0000 Subject: [PATCH] lib.enum: add Python 3.7..3.8 compatibility shim. --- amaranth/lib/enum.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/amaranth/lib/enum.py b/amaranth/lib/enum.py index 0542e35..394583a 100644 --- a/amaranth/lib/enum.py +++ b/amaranth/lib/enum.py @@ -24,6 +24,12 @@ class EnumMeta(ShapeCastable, py_enum.EnumMeta): :meth:`as_shape` is never called, it places no restrictions on the enumeration class or the values of its members. """ + + # TODO: remove this shim once py3.8 support is dropped + @classmethod + def __prepare__(metacls, name, bases, shape=None, **kwargs): + return super().__prepare__(name, bases, **kwargs) + def __new__(metacls, name, bases, namespace, shape=None, **kwargs): cls = py_enum.EnumMeta.__new__(metacls, name, bases, namespace, **kwargs) if shape is not None: