Message394848
Also, note that if identical SQL statements are created in multiple cursors belonging to the same connection, they will currently _not_ be added to the connection weak ref list. See the if (self->statement->in_use) in the middle of _pysqlite_query_execute(). Thus, the current code actually fails to register _all_ statements in the "all statements" weak ref list. IMO, this is yet another argument to abandon that list.
Side note: This branch is not exercised in the unit test suite. Adding the following test will cover this branch:
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index c17f911fa1..8e53c657a6 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -526,6 +526,10 @@ def test_last_row_id_insert_o_r(self):
]
self.assertEqual(results, expected)
+ def test_same_query_in_multiple_cursors(self):
+ cursors = [self.cx.execute("select 1") for _ in range(3)]
+ for cu in cursors:
+ self.assertEqual(cu.fetchall(), [(1,)])
class ThreadTests(unittest.TestCase):
def setUp(self):
See bpo-43553 for sqlite3 coverage improvements. |
|
Date |
User |
Action |
Args |
2021-06-01 10:29:38 | erlendaasland | set | recipients:
+ erlendaasland, berker.peksag, serhiy.storchaka |
2021-06-01 10:29:38 | erlendaasland | set | messageid: <1622543378.87.0.342111545439.issue44079@roundup.psfhosted.org> |
2021-06-01 10:29:38 | erlendaasland | link | issue44079 messages |
2021-06-01 10:29:38 | erlendaasland | create | |
|