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
Fix "�� is not JSON serializable" on Python 3 #382
The head ref may contain hidden characters: "258-\uFFFD\uFFFD-is-not-JSON-serializable"
Fix "�� is not JSON serializable" on Python 3 #382
Conversation
Include upstream modifications: * Removed generic serialization of objects/iterables: ultrajson/ultrajson@53f85b1 * Fix "�� is not JSON serializable" on Python 3: ultrajson/ultrajson#382
Include upstream modifications: * Removed generic serialization of objects/iterables: ultrajson/ultrajson@53f85b1 * Fix "�� is not JSON serializable" on Python 3: ultrajson/ultrajson#382
Include upstream modifications: * Removed generic serialization of objects/iterables: ultrajson/ultrajson@53f85b1 * Fix "�� is not JSON serializable" on Python 3: ultrajson/ultrajson#382
Include upstream modifications: * Removed generic serialization of objects/iterables: ultrajson/ultrajson@53f85b1 * Fix "�� is not JSON serializable" on Python 3: ultrajson/ultrajson#382
I just came across this and am wondering what the error handler string |
It was probably taken from https://stackoverflow.com/a/46202119/724176:
But I also see this PR didn't add any test case with that string, so we could certainly improve that and re-evaluate this! |
Yeah, about that... import ujson
class A:
def __repr__(self):
return '\ud800'
ujson.dumps(A()) → Segmentation fault I'm not sure whether that replacement was ever a thing (couldn't find it anywhere in the Python docs, not even back in Python 3.0), but it definitely isn't now. I guess that belongs in the 'wrong Stack Overflow answers' cabinet. This is similar to #522, and actually I realise now that there are more issues with that string conversion as well. Will follow up with another PR. |
Thanks! |
Errors during `__repr__` itself as well as ones during the conversion to a bytes object were not handled, resulting in NULL pointer dereferencing. Cf. ultrajson#382
Errors during `__repr__` itself as well as ones during the conversion to a bytes object were not handled, resulting in NULL pointer dereferencing. Cf. ultrajson#382
Errors during `__repr__` itself as well as ones during the conversion to a bytes object were not handled, resulting in NULL pointer dereferencing. Cf. #382
Fixes #258.