[Python-3000-checkins] r59180 - python/branches/py3k/Modules/_sqlite/connection.c

georg.brandl python-3000-checkins at python.org
Sun Nov 25 01:45:05 CET 2007


Author: georg.brandl
Date: Sun Nov 25 01:45:05 2007
New Revision: 59180

Modified:
   python/branches/py3k/Modules/_sqlite/connection.c
Log:
#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.


Modified: python/branches/py3k/Modules/_sqlite/connection.c
==============================================================================
--- python/branches/py3k/Modules/_sqlite/connection.c	(original)
+++ python/branches/py3k/Modules/_sqlite/connection.c	Sun Nov 25 01:45:05 2007
@@ -806,6 +806,7 @@
 {
     PyObject* res;
     PyObject* begin_statement;
+    static PyObject* begin_word;
 
     Py_XDECREF(self->isolation_level);
 
@@ -832,11 +833,11 @@
         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;
         }


More information about the Python-3000-checkins mailing list