1. Kirill Simonov
  2. pyyaml
  3. Issues
Issue #27 new

Serialization of enums

Antony Lee
created an issue

Python 3.4 enums are weird beasts, which is probably the reason why they break PyYaml:

>>> from enum import Enum; import yaml
>>> class C(Enum): a = 1
... 
>>> yaml.dump(C.a)
<... traceback elided ...>
  File "/usr/lib/python3.3/site-packages/yaml/representer.py", line 313, in represent_object
    reduce = data.__reduce_ex__(2)
  File "/usr/lib/python3.3/copyreg.py", line 65, in _reduce_ex
    raise TypeError("can't pickle %s objects" % base.__name__)
TypeError: can't pickle int objects

Comments (0)

  1. Log in to comment