diff --git a/python/objToJSON.c b/python/objToJSON.c index a78f3c9..26b77be 100644 --- a/python/objToJSON.c +++ b/python/objToJSON.c @@ -554,7 +554,10 @@ int SortedDict_iterNext(JSOBJ obj, JSONTypeContext *tc) { goto error; } - PyList_SET_ITEM(items, i, item); + if (PyList_SetItem(items, i, item)) + { + goto error; + } Py_DECREF(key); }