[issue27934] json float encoding incorrect for dbus.Double

Eddie James report at bugs.python.org
Fri Sep 2 10:56:29 EDT 2016


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.__repr__ calls the base float method, which is the one we want.

I didn't do any testing for python 3.x as I couldn't figure out how to import dbus into a local build of 3.x. My mistake here.

> For 2.7, we may want to consider processing float instances using `float.__repr__` instead of plain old `repr`

That should work! I'll upload a new patch for 2.7

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27934>
_______________________________________


More information about the Python-bugs-list mailing list