From: Alvaro Herrera Date: Mon, 17 Jan 2011 16:01:04 +0000 (-0300) Subject: Increment Py_None refcount for NULL array elements X-Git-Tag: REL9_0_3~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=051096d06ece0c553e8ed85bfe45129f488a806d;p=postgresql Increment Py_None refcount for NULL array elements Per bug #5835 by Julien Demoor Author: Alex Hunsaker --- diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index ea47067a85..1d5687fba4 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -2042,7 +2042,10 @@ PLyList_FromArray(PLyDatumToOb *arg, Datum d) elm->typlen, elm->typbyval, elm->typalign, &isnull); if (isnull) + { + Py_INCREF(Py_None); PyList_SET_ITEM(list, i, Py_None); + } else PyList_SET_ITEM(list, i, elm->func(elm, elem)); }