summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFrantiĊĦek Nesveda <fnesveda@users.noreply.github.com>2022-12-20 10:54:56 (GMT)
committerGitHub <noreply@github.com>2022-12-20 10:54:56 (GMT)
commitd98ca8172c39326bb200308a5191ceeb4a262d53 (patch)
tree0577a1fab0e3b12981cd70e22d3724199bea01dc /Modules
parenta6331b605e8044a205a113e1db87d2b0a53d0222 (diff)
downloadcpython-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.c5
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;
}