提交 26265c57 编写于 作者: A Alexey Grishchenko 提交者: Dave Cramer

Fixing the bug with deleting non-existent record from Python global dictionary

上级 e4a286a4
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册