-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
enhancementNew feature or requestNew feature or request
Description
NLohmann JSON version 3.10.4 has binary arrays: https://json.nlohmann.me/api/basic_json/binary/
If such array is encountered in JSON object, pyjson::from_json() crashes with stack overflow because it falls to "else // Object" clause and then the for() loop tries to iterate over non-existing values, since binary array is not an object.
Proposed fix:
-
Add include file:
#include "pybind11/numpy.h" -
In pyjson::from_json() add:
...
else if (j.is_binary())
{
const auto &bin = j.get_binary();
return py::array( bin.size(), bin.data() );
}
else // Object
{
...
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request