mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-24641: Improved error message for JSON unserializible keys. (#4364)
Also updated an example for default() in the module docstring. Removed quotes around type name in other error messages.
This commit is contained in:
parent
5b48dc638b
commit
cfa797c068
4 changed files with 19 additions and 13 deletions
|
@ -1650,8 +1650,9 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc,
|
|||
continue;
|
||||
}
|
||||
else {
|
||||
/* TODO: include repr of key */
|
||||
PyErr_SetString(PyExc_TypeError, "keys must be a string");
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"keys must be str, int, float, bool or None, "
|
||||
"not %.100s", key->ob_type->tp_name);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue