summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-11-25 00:45:05 (GMT)
committerGeorg Brandl <georg@python.org>2007-11-25 00:45:05 (GMT)
commitceab6104694c56dc31926af149cbe133988f9574 (patch)
tree8cfc500371b0403ce5629985f94b3abde69e0dd0 /Modules/_sqlite
parent0d84d13c3fcbcec7c476e76dd361a047b8a9c8d2 (diff)
downloadcpython-ceab6104694c56dc31926af149cbe133988f9574.zip
cpython-ceab6104694c56dc31926af149cbe133988f9574.tar.gz
cpython-ceab6104694c56dc31926af149cbe133988f9574.tar.bz2
#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.
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r--Modules/_sqlite/connection.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index d4318de..b6f6492 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -806,6 +806,7 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py
{
PyObject* res;
PyObject* begin_statement;
+ static PyObject* begin_word;
Py_XDECREF(self->isolation_level);
@@ -832,11 +833,11 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py
Py_INCREF(isolation_level);
self->isolation_level = isolation_level;
- begin_statement = PyUnicode_FromString("BEGIN ");
- if (!begin_statement) {
- return -1;
+ if (!begin_word) {
+ begin_word = PyUnicode_FromString("BEGIN ");
+ if (!begin_word) return -1;
}
- PyUnicode_Concat(begin_statement, isolation_level);
+ begin_statement = PyUnicode_Concat(begin_word, isolation_level);
if (!begin_statement) {
return -1;
}