OSDN Git Service

Increment Py_None refcount for NULL array elements
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 17 Jan 2011 16:01:04 +0000 (13:01 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 17 Jan 2011 16:01:04 +0000 (13:01 -0300)
Per bug #5835 by Julien Demoor
Author: Alex Hunsaker

src/pl/plpython/plpython.c

index ea47067..1d5687f 100644 (file)
@@ -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));
        }