diff options
| author | Mark Dickinson <dickinsm@gmail.com> | 2016-09-03 17:45:00 +0100 |
|---|---|---|
| committer | Mark Dickinson <dickinsm@gmail.com> | 2016-09-03 17:45:00 +0100 |
| commit | e6239a3ab3e009a1b15918c1b8182290bb8a2e91 (patch) | |
| tree | 0087bebcd0f62e86f755dfade4326f54845b87d2 /Modules/_json.c | |
| parent | 0ca4b6f5a62ecf75f80a2d8497b30464acfb205e (diff) | |
| download | cpython-git-e6239a3ab3e009a1b15918c1b8182290bb8a2e91.tar.gz | |
Issue #27934: Use float.__repr__ instead of plain repr when JSON-encoding an instance of a float subclass. Thanks Eddie James.
Diffstat (limited to 'Modules/_json.c')
| -rw-r--r-- | Modules/_json.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index c301546057..2d66083186 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1960,8 +1960,8 @@ encoder_encode_float(PyEncoderObject *s, PyObject *obj) 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 * |
