-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OverflowError error message description should be improved #339
Comments
I opened a PR to fix this issue: #340 |
Hello, thank you very much for the issue and PR. Since UltraJSON 2.0 was released with 53f85b1, this is no longer valid:
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(.startup.py)
(imported collections, datetime, itertools, math, os, pprint, re, sys, time)
>>> import numpy
>>> import ujson
>>> ujson.dumps(numpy.bool_(True))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: � is not JSON serializable
>>> The "�" bit is another issue: #258. So let's close this. Thanks again for contributing! |
Awesome, thanks for continuing to improve ujson! |
Right now,
ujson
gives this error when you try to encode certain types (e.g.numpy.bool_
) that cannot be encoded:For example, you can get this error by running this code:
This error does not indicate what actually went wrong, which is that
numpy.bool_
objects cannot be encoded.As a basic fix for this problem, I'd suggest changing the error message to:
The text was updated successfully, but these errors were encountered: