Message407185
Since 243b6c3b8fd3144450c477d99f01e31e7c3ebc0f (21-08-19), this bug can't be reproduced.
In `pysqlite_do_all_statements()`, 243b6c3 resets statements like this:
sqlite3_stmt *stmt = NULL;
while ((stmt = sqlite3_next_stmt(self->db, stmt))) {
if (sqlite3_stmt_busy(stmt)) {
(void)sqlite3_reset(stmt);
}
}
But the `pysqlite_Statement.in_use` flag is not reset.
In `_pysqlite_query_execute()` function, if `pysqlite_Statement.in_use` flag is 1, it creates a new `pysqlite_Statement` instance. So this line will use a new statement:
gen = conn.execute("SELECT c FROM t WHERE ?", (1,))
The duplicate row is from `pysqlite_Cursor.next_row` before 3df0fc89bc2714f5ef03e36a926bc795dcd5e05a (21-08-25).
A digressive suggestion is whether it can be changed like this, and add a check for resetting statement. So that statements are not allowed to be reset by other Cursors, which may improve code robust:
typedef struct
{
...
- int in_use;
+ pysqlite_Cursor *in_use; // points to the attached cursor
...
} pysqlite_Statement; |
|
Date |
User |
Action |
Args |
2021-11-28 04:26:09 | malin | set | recipients:
+ malin, benjamin.peterson, berker.peksag, serhiy.storchaka, Maxime Belanger, palaviv, cary, xtreak, erlendaasland |
2021-11-28 04:26:09 | malin | set | messageid: <1638073569.05.3.24629207674e-05.issue33376@roundup.psfhosted.org> |
2021-11-28 04:26:09 | malin | link | issue33376 messages |
2021-11-28 04:26:08 | malin | create | |
|