summaryrefslogtreecommitdiffstats
path: root/src/pl/plpython/plpy_exec.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/pl/plpython/plpy_exec.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index 993a4e2..953c2d4 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -691,7 +691,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
*pltrelid,
*plttablename,
*plttableschema,
- *pltargs = NULL,
+ *pltargs,
*pytnew,
*pytold,
*pltdata;
@@ -715,6 +715,11 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
return NULL;
}
}
+ else
+ {
+ Py_INCREF(Py_None);
+ pltargs = Py_None;
+ }
PG_TRY();
{
@@ -858,7 +863,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
PyObject *pltarg;
/* pltargs should have been allocated before the PG_TRY block. */
- Assert(pltargs);
+ Assert(pltargs && pltargs != Py_None);
for (i = 0; i < tdata->tg_trigger->tgnargs; i++)
{
@@ -872,8 +877,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
}
else
{
- Py_INCREF(Py_None);
- pltargs = Py_None;
+ Assert(pltargs == Py_None);
}
PyDict_SetItemString(pltdata, "args", pltargs);
Py_DECREF(pltargs);