summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
diff options
context:
space:
mode:
authorGerhard Häring <gh@ghaering.de>2008-09-12 22:33:22 (GMT)
committerGerhard Häring <gh@ghaering.de>2008-09-12 22:33:22 (GMT)
commite6872eb41710f14d35616b168f21d85c96d26ff7 (patch)
tree264c63a5fea62107ede51bff3901c4b58eec18c7 /Modules/_sqlite/statement.c
parent6e1afcf9883f13bdf8808dc528e381f5c90a131b (diff)
downloadcpython-e6872eb41710f14d35616b168f21d85c96d26ff7.zip
cpython-e6872eb41710f14d35616b168f21d85c96d26ff7.tar.gz
cpython-e6872eb41710f14d35616b168f21d85c96d26ff7.tar.bz2
Issue #3846: Release GIL during calls to sqlite3_prepare. This improves concurrent access to the same database file from multiple threads/processes.
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r--Modules/_sqlite/statement.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index dae83d4..f200c56 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -79,11 +79,13 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
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 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params)
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