Index: statement.c =================================================================== --- statement.c (revision 66403) +++ statement.c (working copy) @@ -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 Index: cursor.c =================================================================== --- cursor.c (revision 66403) +++ cursor.c (working copy) @@ -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;