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

HextuplesParser could/should use json.loads with strict=False #2809

Open
lu-pl opened this issue Jun 24, 2024 · 0 comments
Open

HextuplesParser could/should use json.loads with strict=False #2809

lu-pl opened this issue Jun 24, 2024 · 0 comments
Assignees

Comments

@lu-pl
Copy link
Contributor

lu-pl commented Jun 24, 2024

Running property-based tests on an application showed that certain literal values, e.g. "\x08" and "\x1f" get rejected by the hext parser, i.e. parsing fails with an json.decoder.JSONDecodeError.

I think the problem can be remedied by using the strict=False flag in plugins.parsers.hext.HextuplesParser._load_json_line (hext.py, line 34).

import json

data = '["_:Nc5eeb3ec48394ee6b8219ec7b3ea55b9", "https://predicate/e674011e-9fcb-0c07-a107-391243867e06", "\x08", "http://www.w3.org/2001/XMLSchema#string", "", ""]'

json.loads(data)                          # JSONDecodeError
json.loads(data, strict=False)   # loading successful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants