Skip to content

Commit 47c5474

Browse files
Issue #26623: TypeError message for JSON unserializible object now contains
object's type name, not object's representation. Based on patch by Mahmoud Lababidi.
1 parent 03f17f8 commit 47c5474

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/json/encoder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ def default(self, o):
176176
return JSONEncoder.default(self, o)
177177
178178
"""
179-
raise TypeError(repr(o) + " is not JSON serializable")
179+
raise TypeError("Object of type '%s' is not JSON serializable" %
180+
o.__class__.__name__)
180181

181182
def encode(self, o):
182183
"""Return a JSON string representation of a Python data structure.

0 commit comments

Comments
 (0)