diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-10 15:46:30 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-10 15:46:30 +0300 |
commit | 47c5474aa0cbe8dc3cf2c370b19769edd3f2e8d8 (patch) | |
tree | b0617362898cabfe72cb8d9506f584f14362728e /Lib/json/encoder.py | |
parent | 03f17f86717372ca010273dc8946fd19914a534b (diff) | |
download | cpython-git-47c5474aa0cbe8dc3cf2c370b19769edd3f2e8d8.tar.gz |
Issue #26623: TypeError message for JSON unserializible object now contains
object's type name, not object's representation.
Based on patch by Mahmoud Lababidi.
Diffstat (limited to 'Lib/json/encoder.py')
-rw-r--r-- | Lib/json/encoder.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py index d596489f42..0772bbc06b 100644 --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -176,7 +176,8 @@ class JSONEncoder(object): return JSONEncoder.default(self, o) """ - raise TypeError(repr(o) + " is not JSON serializable") + raise TypeError("Object of type '%s' is not JSON serializable" % + o.__class__.__name__) def encode(self, o): """Return a JSON string representation of a Python data structure. |