diff options
author | FrantiĊĦek Nesveda <fnesveda@users.noreply.github.com> | 2022-12-20 10:54:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 10:54:56 (GMT) |
commit | d98ca8172c39326bb200308a5191ceeb4a262d53 (patch) | |
tree | 0577a1fab0e3b12981cd70e22d3724199bea01dc /Modules | |
parent | a6331b605e8044a205a113e1db87d2b0a53d0222 (diff) | |
download | cpython-d98ca8172c39326bb200308a5191ceeb4a262d53.zip cpython-d98ca8172c39326bb200308a5191ceeb4a262d53.tar.gz cpython-d98ca8172c39326bb200308a5191ceeb4a262d53.tar.bz2 |
gh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_json.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index 6879ad3..fa8e2a9 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1319,9 +1319,10 @@ encoder_encode_float(PyEncoderObject *s, PyObject *obj) double i = PyFloat_AS_DOUBLE(obj); if (!Py_IS_FINITE(i)) { if (!s->allow_nan) { - PyErr_SetString( + PyErr_Format( PyExc_ValueError, - "Out of range float values are not JSON compliant" + "Out of range float values are not JSON compliant: %R", + obj ); return NULL; } |