]> granicus.if.org Git - python/commitdiff
be extra careful with a borrowed reference when the GIL could be released (closes...
authorBenjamin Peterson <benjamin@python.org>
Wed, 1 Jun 2011 02:31:37 +0000 (21:31 -0500)
committerBenjamin Peterson <benjamin@python.org>
Wed, 1 Jun 2011 02:31:37 +0000 (21:31 -0500)
Modules/_sqlite/connection.c

index e4969e36a347e78003cd1e13c038f086f10ef533..7d12d5ef61f7dbdf54334e865315868a594553f8 100644 (file)
@@ -200,11 +200,13 @@ void pysqlite_do_all_statements(pysqlite_Connection* self, int action, int reset
         weakref = PyList_GetItem(self->statements, i);
         statement = PyWeakref_GetObject(weakref);
         if (statement != Py_None) {
+            Py_INCREF(statement);
             if (action == ACTION_RESET) {
                 (void)pysqlite_statement_reset((pysqlite_Statement*)statement);
             } else {
                 (void)pysqlite_statement_finalize((pysqlite_Statement*)statement);
             }
+            Py_DECREF(statement);
         }
     }