mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Issue #26623: TypeError message for JSON unserializible object now contains
object's type name, not object's representation. Based on patch by Mahmoud Lababidi.
This commit is contained in:
parent
03f17f8671
commit
47c5474aa0
1 changed files with 2 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue