From 46f4ca6e43ea7d327392b4605dc9d733591caebc Mon Sep 17 00:00:00 2001 From: Alexander Goldstein Date: Sat, 4 Jan 2014 22:15:43 -0600 Subject: [PATCH] pythonSequenceToTuple was losing NULLs --- src/python.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/python.c b/src/python.c index 1e57fe71a..b3ee1efe3 100644 --- a/src/python.c +++ b/src/python.c @@ -1165,16 +1165,24 @@ pythonSequenceToTuple(PyObject *p_value, continue; } p_object = PySequence_GetItem(p_value, j); - 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);