diff Modules/_sqlite/connection.c @ 59559:1ee2452ce942 legacy-trunk

sqlite3: Fix a segfault on calling a connection with something else than a string. Initialize all attributes to be able to call the statement destructor on error. Avoid also a duplicate connection in some tests: setUp() does already open a connection (":memory:").
author Victor Stinner <victor.stinner@haypocalc.com>
date Sat, 13 Mar 2010 03:27:07 +0000
parents 04d3ae52ff73
children 6899139301c9
line wrap: on
line diff
--- a/Modules/_sqlite/connection.c	Sat Mar 13 01:21:34 2010 +0000
+++ b/Modules/_sqlite/connection.c	Sat Mar 13 03:27:07 2010 +0000
@@ -1197,6 +1197,12 @@
         return NULL;
     }
 
+    statement->db = NULL;
+    statement->st = NULL;
+    statement->sql = NULL;
+    statement->in_use = 0;
+    statement->in_weakreflist = NULL;
+
     rc = pysqlite_statement_create(statement, self, sql);
 
     if (rc != SQLITE_OK) {