diff --git a/src/python.c b/src/python.c index 2f9fd803c..ee50f35dc 100644 --- a/src/python.c +++ b/src/python.c @@ -1271,21 +1271,24 @@ pythonSequenceToTuple(PyObject *p_value, continue; } p_object = PySequence_GetItem(p_value, j); - if(p_object == NULL || p_object == Py_None){ - nulls[i] = true; - values[i] = 0; - continue; - } - resetStringInfo(buffer); - values[i] = pyobjectToDatum(p_object, buffer, - cinfos[cinfo_idx]); - if (buffer->data == NULL) - { - nulls[i] = true; - } - else + if (p_object != NULL && p_object != Py_None) { - nulls[i] = false; + resetStringInfo(buffer); + values[i] = pyobjectToDatum(p_object, buffer, + cinfos[cinfo_idx]); + if (buffer->data == NULL) + { + nulls[i] = true; + } + else + { + nulls[i] = false; + } + } + else + { + values[i] = (Datum) NULL; + nulls[i] = true; } errorCheck(); Py_DECREF(p_object);