-
-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
Issue Description
When using simdjson.Parser.parse
, checking if a None
key exists in the parsed object results in a TypeError: expected bytes, NoneType found
.
Example Code:
import simdjson
parser = simdjson.Parser()
doc = parser.parse(b'{"res": [{"name": "first"}, {"name": "second"}]}')
if not None in doc: # This line raises the error
pass
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "simdjson/csimdjson.pyx", line 316, in csimdjson.Object.__contains__
TypeError: expected bytes, NoneType found
Expected Behavior
The check should return False
(as it does with simdjson.loads
), since None
is not a valid JSON key.
Working Example with simdjson.loads
:
import simdjson
doc = simdjson.loads(b'{"res": [{"name": "first"}, {"name": "second"}]}')
if not None in doc: # Correctly returns False
pass
Metadata
Metadata
Assignees
Labels
No labels