Kaydet (Commit) 47c5474a authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #26623: TypeError message for JSON unserializible object now contains

object's type name, not object's representation.
Based on patch by Mahmoud Lababidi.
üst 03f17f86
...@@ -176,7 +176,8 @@ class JSONEncoder(object): ...@@ -176,7 +176,8 @@ class JSONEncoder(object):
return JSONEncoder.default(self, o) 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): def encode(self, o):
"""Return a JSON string representation of a Python data structure. """Return a JSON string representation of a Python data structure.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment