[issue27934] json float encoding incorrect for dbus.Double
Mark Dickinson
report at bugs.python.org
Fri Sep 2 13:54:01 EDT 2016
Mark Dickinson added the comment:
Note that this will also change the results for JSON output of NumPy float64 values, so at the very least I'd expect this change to break (admittedly poorly written) unit tests / doctests.
Python 2.7.12 (default, Jul 10 2016, 18:28:23)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import json
>>> x = np.float64(3.3)
>>> json.dumps(x)
'3.2999999999999998'
>>> repr(x)
'3.2999999999999998'
>>> float.__repr__(x)
'3.3'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27934>
_______________________________________
More information about the Python-bugs-list
mailing list