From 7ae7e0b50ddca3ae8cbc1a7f21daa046299a511a Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 15 Oct 2023 02:08:32 +0800 Subject: [PATCH] fix CI --- 3rd/cjson/src/cJSONw.cpp | 2 +- tests/80_json.py | 6 +++++- tests/82_ldtk.py | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/3rd/cjson/src/cJSONw.cpp b/3rd/cjson/src/cJSONw.cpp index 38b352ce..4b5fb712 100644 --- a/3rd/cjson/src/cJSONw.cpp +++ b/3rd/cjson/src/cJSONw.cpp @@ -127,7 +127,7 @@ void add_module_cjson(VM* vm){ const Str& expr = CAST(Str&, args[0]); - cJSON *json = cJSON_Parse(expr.c_str()); + cJSON *json = cJSON_ParseWithLength(expr.data, expr.size); PyObject* output = convert_cjson_to_python_object(json, vm); cJSON_Delete(json); diff --git a/tests/80_json.py b/tests/80_json.py index f6e467bb..17e09498 100644 --- a/tests/80_json.py +++ b/tests/80_json.py @@ -14,7 +14,11 @@ a = { 'h': False } -import cjson as json +try: + import cjson as json + print('[INFO] cjson is used') +except ImportError: + import json _j = json.dumps(a) _a = json.loads(_j) diff --git a/tests/82_ldtk.py b/tests/82_ldtk.py index bfb064b5..5d480955 100644 --- a/tests/82_ldtk.py +++ b/tests/82_ldtk.py @@ -1,4 +1,8 @@ -import cjson as json +try: + import cjson as json + print('[INFO] cjson is used') +except ImportError: + import json _2489KB = 'WorldMap_GridVania_layout.ldtk' _1093KB = 'WorldMap_Free_layout.ldtk'