diff -r e065aec0e6fa Lib/json/encoder.py --- a/Lib/json/encoder.py Thu Sep 01 11:21:56 2016 -0700 +++ b/Lib/json/encoder.py Fri Sep 02 11:01:32 2016 -0500 @@ -28,7 +28,7 @@ #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) INFINITY = float('inf') -FLOAT_REPR = repr +FLOAT_REPR = float.__repr__ def encode_basestring(s): """Return a JSON representation of a Python string diff -r e065aec0e6fa Modules/_json.c --- a/Modules/_json.c Thu Sep 01 11:21:56 2016 -0700 +++ b/Modules/_json.c Fri Sep 02 11:01:32 2016 -0500 @@ -1960,8 +1960,8 @@ return PyString_FromString("NaN"); } } - /* Use a better float format here? */ - return PyObject_Repr(obj); + /* Make sure to use the base float class repr method */ + return PyFloat_Type.tp_repr(obj); } static PyObject *