#1480: fix refleak in the sqlite module.

It came from rev 58682. The reason is that PyString_Concat
and PyUnicode_Concat work differently -- the equivalent to
PyString_Concat is PyUnicode_Append.
This commit is contained in:
Georg Brandl 2007-11-25 00:45:05 +00:00
parent 0d84d13c3f
commit ceab610469
1 changed files with 5 additions and 4 deletions

View File

@ -806,6 +806,7 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py
{ {
PyObject* res; PyObject* res;
PyObject* begin_statement; PyObject* begin_statement;
static PyObject* begin_word;
Py_XDECREF(self->isolation_level); Py_XDECREF(self->isolation_level);
@ -832,11 +833,11 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py
Py_INCREF(isolation_level); Py_INCREF(isolation_level);
self->isolation_level = isolation_level; self->isolation_level = isolation_level;
begin_statement = PyUnicode_FromString("BEGIN "); if (!begin_word) {
if (!begin_statement) { begin_word = PyUnicode_FromString("BEGIN ");
return -1; if (!begin_word) return -1;
} }
PyUnicode_Concat(begin_statement, isolation_level); begin_statement = PyUnicode_Concat(begin_word, isolation_level);
if (!begin_statement) { if (!begin_statement) {
return -1; return -1;
} }