Skip to content

v1.13

Compare
Choose a tag to compare
@Fatal1ty Fatal1ty released this 18 Sep 10:39
· 1077 commits to master since this release

Fix for custom Enum serializable classes

In the version 1.12 if you inherit both Enum and SerializableType classes you will get an exception TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases like in the following example:

class Example(IntEnum, SerializableType):
    A = 1
    B = 2

    def _serialize(self):
        return {"value": self.name}

    @classmethod
    def _deserialize(cls, value):
        return Example.__members__[value["value"]]