You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is a bug, or just something that can't be supported. I've reviewed some of the other issues surrounding metaclasses and it seems there isn't a workaround.
This case is a little different though, my classes which inherit from Struct do not define a metaclass - but instead they have a property which is a subclass of Enum with a metaclass.
I put together a minimal reproducible example. Is it possible to support this use case?
I'm having a similar issue when using msgspec with django TextChoices.
A minimal reproducible example:
importmsgspecfromdjango.dbimportmodelsclassSomeEnum(models.TextChoices): # class TextChoices(str, enum.Enum, metaclass=ChoicesMeta)EXAMPLE_VALUE="hello"classSomeModel(msgspec.Struct):
values: SomeEnummsgspec.json.encode(SomeModel(SomeEnum.EXAMPLE_VALUE))
# TypeError: Encoding objects of type SomeEnum is unsupported
I'd love to give some help if it makes sense for this
Description
I don't know if this is a bug, or just something that can't be supported. I've reviewed some of the other issues surrounding metaclasses and it seems there isn't a workaround.
This case is a little different though, my classes which inherit from
Struct
do not define a metaclass - but instead they have a property which is a subclass ofEnum
with a metaclass.I put together a minimal reproducible example. Is it possible to support this use case?
Output:
Version info:
Thanks in advance for your time, love the library - it massively improved performance for me.
The text was updated successfully, but these errors were encountered: