Skip to content
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

Properly populate JSONDecodeError & UnicodeDecodeError #46

Open
TkTech opened this issue Jul 20, 2020 · 2 comments
Open

Properly populate JSONDecodeError & UnicodeDecodeError #46

TkTech opened this issue Jul 20, 2020 · 2 comments
Labels
blocked Blocked by external projects (toolchains, OS issues, etc) bug Something isn't working upstream change required This issue requires changes in the simdjson library

Comments

@TkTech
Copy link
Owner

TkTech commented Jul 20, 2020

We currently raise a ValueError instead of JSONDecodeError (which is a ValueError subclass) in some cases where JSONDecodeError would be more appropriate. This is because upstream simdjson does not report errors with enough granularity to populate lineno and colno (https://docs.python.org/3/library/json.html#json.JSONDecodeError)

Might be viable to return 0 and 0 for now?

@TkTech TkTech added bug Something isn't working upstream change required This issue requires changes in the simdjson library blocked Blocked by external projects (toolchains, OS issues, etc) labels Jul 20, 2020
@lemire
Copy link
Contributor

lemire commented Jul 20, 2020

Please ping issue simdjson/simdjson#237

This is not a fundamental limitation and it is simply a matter of doing the coding.

@TkTech
Copy link
Owner Author

TkTech commented Aug 10, 2020

We have the same issue with UnicodeDecodeError here https://github.com/TkTech/pysimdjson/blob/master/simdjson/binding.cpp#L227. However, very few projects I could find seem to care about the additional properties, and those that do use the error in such a way that they would just see a blank string rather than a crash.

@TkTech TkTech changed the title Properly populate JSONDecodeError Properly populate JSONDecodeError & UnicodeDecodeError Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by external projects (toolchains, OS issues, etc) bug Something isn't working upstream change required This issue requires changes in the simdjson library
Projects
None yet
Development

No branches or pull requests

2 participants