diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2017-11-25 15:38:20 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-25 15:38:20 (GMT) |
| commit | cfa797c0681b7fef47cf93955fd06b54ddd09a7f (patch) | |
| tree | 6e4ecf5ed329d339b26f1eb2bf1f73950abbee72 /Modules/_json.c | |
| parent | 5b48dc638b7405fd9bde4d854bf477dfeaaddf44 (diff) | |
| download | cpython-cfa797c0681b7fef47cf93955fd06b54ddd09a7f.zip cpython-cfa797c0681b7fef47cf93955fd06b54ddd09a7f.tar.gz cpython-cfa797c0681b7fef47cf93955fd06b54ddd09a7f.tar.bz2 | |
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.
Diffstat (limited to 'Modules/_json.c')
| -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 13218a6..5a9464e 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -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; } |
