[issue27934] json float encoding incorrect for dbus.Double

2016-09-02 Thread Eddie James
Changes by Eddie James : Added file: http://bugs.python.org/file44349/json-float-repr-2.7.patch ___ Python tracker <http://bugs.python.org/issue27934> ___ ___ Python-bug

[issue27934] json float encoding incorrect for dbus.Double

2016-09-02 Thread Eddie James
Eddie James added the comment: Python 2.7 also already behaves correctly for other dbus types: Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import

[issue27934] json float encoding incorrect for dbus.Double

2016-09-02 Thread Eddie James
Eddie James added the comment: Wait what about the json C code for 2.7? That's still using PyObject_Repr() which will call tp_repr for dbus.Double... Any suggestions? -- ___ Python tracker <http://bugs.python.org/is

[issue27934] json float encoding incorrect for dbus.Double

2016-09-02 Thread Eddie James
Eddie James added the comment: Thanks Mark, yes you installed the right package. OK I didn't dig deep enough in the sub class. And yea, there shouldn't be any difference between float.__repr__ and float.__str__. Obviously repr calls the object's tp_repr method, while float.__r

[issue27934] json float encoding incorrect for dbus.Double

2016-09-02 Thread Eddie James
Eddie James added the comment: Understood on 2.7, I wasn't aware it would cause any issues. Dbus.Double is not a subclass of float unfortunately. Problem is that all Dbus types seem to have a custom tp_repr method that returns that strange formatting I mentioned. So repr won't be t

[issue27934] json float encoding incorrect for dbus.Double

2016-09-01 Thread Eddie James
Changes by Eddie James : Added file: http://bugs.python.org/file44334/json-float-str-2.7.patch ___ Python tracker <http://bugs.python.org/issue27934> ___ ___ Python-bug

[issue27934] json float encoding incorrect for dbus.Double

2016-09-01 Thread Eddie James
New submission from Eddie James: JSON does not correctly encode dbus.Double types, even though all other dbus types are handled fine. I end up with output like this (0.25 is the floating point value): dbus.Double(0.25, variant_level=1) Found that the encoding uses repr() for float objects but