mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Update cJSONw.cpp
This commit is contained in:
parent
7922513255
commit
acdab59d94
@ -115,8 +115,12 @@ void add_module_cjson(VM* vm){
|
|||||||
const Str& string = CAST(Str&, args[0]);
|
const Str& string = CAST(Str&, args[0]);
|
||||||
cJSON *json = cJSON_ParseWithLength(string.data, string.size);
|
cJSON *json = cJSON_ParseWithLength(string.data, string.size);
|
||||||
if(json == NULL){
|
if(json == NULL){
|
||||||
const char* err = cJSON_GetErrorPtr();
|
const char* start = cJSON_GetErrorPtr();
|
||||||
vm->IOError(fmt("cjson: ", err));
|
const char* end = start;
|
||||||
|
while(*end != '\0' && *end != '\n'){
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
vm->IOError(fmt("cjson: ", std::string_view(start, end-start)));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
PyObject* output = convert_cjson_to_python_object(json, vm);
|
PyObject* output = convert_cjson_to_python_object(json, vm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user