Issue 35464: json.dumps very unclear exception (original) (raw)

Issue35464

Created on 2018-12-11 14:52 by orshemy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg331632 - (view) Author: Or (orshemy) Date: 2018-12-11 14:52
when dumping a value coming from numpy.random.choice([True,False]) the exception raised is very unclear. json.dumps(result) File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 184, in default raise TypeError(repr(o) + " is not JSON serializable") which prints "True is not JSON serializable" - but it should actually print "<type 'numpy.bool_'> is not JSON serializable".
msg331633 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-11 15:21
This was changed in 3.6 (). Upgrade to 3.6+ for better error messages.
History
Date User Action Args
2022-04-11 14:59:09 admin set github: 79645
2018-12-11 15:21:12 serhiy.storchaka set status: open -> closednosy: + serhiy.storchakamessages: + resolution: out of datestage: resolved
2018-12-11 14:52:03 orshemy create