diff --git a/PyInt.cpp b/PyInt.cpp index 2cb33424..4d6149c7 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -500,11 +500,11 @@ python_taskqueue::error() { std::vector python_external_utils::PyObjectToStringArray(PyObject *pyList) { std::vector result; - + std::vector emptyIfError = {}; if (!PySequence_Check(pyList)) { - ErrorLog("Provided PyObject is not a sequence."); - return result; + ErrorLog("Python: Failed to convert PyObject -> vector"); + return emptyIfError; } Py_ssize_t size = PySequence_Size(pyList); @@ -513,16 +513,16 @@ std::vector python_external_utils::PyObjectToStringArray(PyObject * PyObject *item = PySequence_GetItem(pyList, i); // Increments reference count if (item == nullptr) { - ErrorLog("Failed to get item from sequence."); - return result; + ErrorLog("Python: Failed to get item from sequence."); + return emptyIfError; } const char *str = PyString_AsString(item); if (str == nullptr) { Py_DECREF(item); - ErrorLog("Failed to convert item to string."); - return result; + ErrorLog("Python: Failed to convert item to string."); + return emptyIfError; } result.push_back(std::string(str));