diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 3d677cd8ea0656efe9dd2aa8ea3edd69ab9d28c6..ec2f0a5bbfd74545c8b334a7ce655995ac19d359 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1517,13 +1517,21 @@ static void PLy_function_delete_args(PLyProcedure *proc) { int i; + PyObject *arg; if (!proc->argnames) return; for (i = 0; i < proc->nargs; i++) - if (proc->argnames[i]) - PyDict_DelItemString(proc->globals, proc->argnames[i]); + if (proc->argnames[i]) { + arg = PyString_FromString(proc->argnames[i]); + + /* Deleting the item only if it exists in the dictionaty */ + if (PyDict_Contains(proc->globals, arg)) { + PyDict_DelItem(proc->globals, arg); + } + Py_DECREF(arg); + } } /* @@ -2045,12 +2053,12 @@ PLy_procedure_munge_source(const char *name, const char *src) } } - pyelog(INFO, "After searching the start of the string, index is: %d sf is: %d endquote is: %c", i, sf, cendquote); + pyelog(INFO, "After searching the start of the string, index is: %d sf is: %d endquote is: %c", (int)i, sf, cendquote); /* now copy all characters to the destination buffer if we see the beginning of a string */ while (sf != STRING_BEGIN_NOT_YET && sf != STRING_SEEN_END && i < olen) { - pyelog(INFO, "copying src[%d]=%c", i, src[i]); + pyelog(INFO, "copying src[%d]=%c", (int)i, src[i]); BOUNDED_PTR_ASSIGN_INC(mp, mrc + mlen, src[i]); @@ -2079,7 +2087,7 @@ PLy_procedure_munge_source(const char *name, const char *src) i++; } - pyelog(INFO, "After searching the END of the string, index is: %d sf is: %d", i, sf); + pyelog(INFO, "After searching the END of the string, index is: %d sf is: %d", (int)i, sf); if (i == olen) break;