[issue18264] enum.IntEnum is not compatible with JSON serialisation
Ethan Furman
report at bugs.python.org
Wed Jun 19 22:15:25 CEST 2013
Ethan Furman added the comment:
I was unable to find any references to previous problems with json and floats. A quick-n-dirty patch yields the following:
--> from json import dumps, loads
--> from enum import Enum
--> class FE(float, Enum):
... pass
...
--> class Test(FE):
... one = 1.0
...
--> Test.one
<Test.one: 1.0>
--> str(Test.one)
'1.0'
--> dumps(Test.one)
'1.0'
--> loads(dumps(Test.one))
1.0
All json and enum tests are still passing.
If this is an acceptable solution I'll create a nicer patch and post for review.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18264>
_______________________________________
More information about the Python-bugs-list
mailing list