mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
gh-99925: Fix inconsistency in json.dumps()
error messages (GH-99926)
This commit is contained in:
parent
a6331b605e
commit
d98ca8172c
3 changed files with 9 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue