Erlend E. Aasland <erlend.aasl...@innova.no> added the comment:

FYI: We've been using sqlite3_close_v2(), when available, since 2017 (see 
86a670543ff97d52fd9b8ca0477f8b6d27ee946d), but we now call it with GIL held.

I'm leaning towards closing this as out-of-date. There is no reproducer, there 
has been no more similar bug reports, and there has been no activity on this 
issue.


Possible improvement of connection_close():
  1. save database pointer to temporary variable
  2. clear self->db
  3. call sqlite3_close_v2() (without holding GIL)

diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index d6d1fa8bf2..47c0267e89 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -301,9 +301,12 @@ static void
 connection_close(pysqlite_Connection *self)
 {
     if (self->db) {
-        int rc = sqlite3_close_v2(self->db);
-        assert(rc == SQLITE_OK), (void)rc;
+        sqlite *db = self->db;
         self->db = NULL;
+        Py_BEGIN_ALLOW_THREADS
+        int rc = sqlite3_close_v2(db);
+        assert(rc == SQLITE_OK), (void)rc;
+        Py_END_ALLOW_THREADS
     }
 }
 }

----------
nosy: +erlendaasland

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26387>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to