Closed
Description
Steps to reproduce:
import yaml
import enum
class Spam(enum.Enum):
Value = 1
yaml.dump(Spam)
gives
TypeError: __reduce_ex__() missing 1 required positional argument: 'proto'
in represent_object(self, data)
.
My analysis:
The dumping code is calling Spam
's __reduce_ex__
method on the class itself and therefore supplies one argument less than needed. Since enum.Enum
has a meta class, the normal dumping for type
instances is not run.
Adding a representer for enum.EnumMeta
is a simple workaround, but I suppose the problem could also be solved by making
the representer for type
a multi representer.
Metadata
Metadata
Assignees
Labels
No labels