diff Modules/_sqlite/statement.c @ 49155:76bc75772736 legacy-trunk

Issue #3846: Release GIL during calls to sqlite3_prepare. This improves concurrent access to the same database file from multiple threads/processes.
author Gerhard Häring <gh@ghaering.de>
date Fri, 12 Sep 2008 22:33:22 +0000
parents 4c77d1016f60
children 787b969d37f0 04d3ae52ff73
line wrap: on
line diff
--- a/Modules/_sqlite/statement.c	Fri Sep 12 18:58:57 2008 +0000
+++ b/Modules/_sqlite/statement.c	Fri Sep 12 22:33:22 2008 +0000
@@ -79,11 +79,13 @@
 
     sql_cstr = PyString_AsString(sql_str);
 
+    Py_BEGIN_ALLOW_THREADS
     rc = sqlite3_prepare(connection->db,
                          sql_cstr,
                          -1,
                          &self->st,
                          &tail);
+    Py_END_ALLOW_THREADS
 
     self->db = connection->db;
 
@@ -328,11 +330,13 @@
 
     sql_cstr = PyString_AsString(self->sql);
 
+    Py_BEGIN_ALLOW_THREADS
     rc = sqlite3_prepare(self->db,
                          sql_cstr,
                          -1,
                          &new_st,
                          &tail);
+    Py_END_ALLOW_THREADS
 
     if (rc == SQLITE_OK) {
         /* The efficient sqlite3_transfer_bindings is only available in SQLite