This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author malin
Recipients Maxime Belanger, benjamin.peterson, berker.peksag, cary, erlendaasland, malin, palaviv, serhiy.storchaka, xtreak
Date 2021-11-28.04:26:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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)) {
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:09malinsetrecipients: + malin, benjamin.peterson, berker.peksag, serhiy.storchaka, Maxime Belanger, palaviv, cary, xtreak, erlendaasland
2021-11-28 04:26:09malinsetmessageid: <>
2021-11-28 04:26:09malinlinkissue33376 messages
2021-11-28 04:26:08malincreate