[Python-checkins] r66414 - in python/trunk: Misc/NEWS Modules/_sqlite/cursor.c Modules/_sqlite/statement.c
gerhard.haering
python-checkins at python.org
Sat Sep 13 00:33:22 CEST 2008
Author: gerhard.haering
Date: Sat Sep 13 00:33:22 2008
New Revision: 66414
Log:
Issue #3846: Release GIL during calls to sqlite3_prepare. This improves concurrent access to the same database file from multiple threads/processes.
Modified:
python/trunk/Misc/NEWS
python/trunk/Modules/_sqlite/cursor.c
python/trunk/Modules/_sqlite/statement.c
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sat Sep 13 00:33:22 2008
@@ -151,6 +151,10 @@
- Issue #3103: Reduced globals symbols used by sqlite3 module and made sure all
remaining ones have "pysqlite_" prefix.
+- Issue #3846: Release the GIL during sqlite3_prepare calls. This improves
+ concurrent access to the same SQLite database from multiple
+ threads/processes.
+
Tests
-----
Modified: python/trunk/Modules/_sqlite/cursor.c
==============================================================================
--- python/trunk/Modules/_sqlite/cursor.c (original)
+++ python/trunk/Modules/_sqlite/cursor.c Sat Sep 13 00:33:22 2008
@@ -790,11 +790,13 @@
}
statement_completed = 1;
+ Py_BEGIN_ALLOW_THREADS
rc = sqlite3_prepare(self->connection->db,
script_cstr,
-1,
&statement,
&script_cstr);
+ Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->connection->db, NULL);
goto error;
Modified: python/trunk/Modules/_sqlite/statement.c
==============================================================================
--- python/trunk/Modules/_sqlite/statement.c (original)
+++ python/trunk/Modules/_sqlite/statement.c Sat Sep 13 00:33:22 2008
@@ -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
More information about the Python-checkins
mailing list