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.

Title: Unnecessary variable assignment and initial loop check in pysqlite_cursor_executescript
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alex.henrie, berker.peksag, ghaering
Priority: normal Keywords: patch

Created on 2020-02-02 02:05 by alex.henrie, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18305 merged alex.henrie, 2020-02-02 02:06
Messages (2)
msg361200 - (view) Author: Alex Henrie (alex.henrie) * Date: 2020-02-02 02:05
pysqlite_cursor_executescript currently has the following while loop:

    /* execute statement, and ignore results of SELECT statements */
    rc = SQLITE_ROW;
    while (rc == SQLITE_ROW) {
        rc = pysqlite_step(statement, self->connection);
        if (PyErr_Occurred()) {
            goto error;

This can and should be rewritten as a do-while loop to avoid having to initialize rc to SQLITE_ROW and then check its value knowing that the value check will succeed.
msg387901 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-03-02 07:40
New changeset 25e244c92501e84b0fd6e7539e15c0e640d42cc1 by Alex Henrie in branch 'master':
bpo-39523: Use do-while loop pysqlite_cursor_executescript() (GH-18305)
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83704
2021-03-02 07:41:32berker.peksagsetstatus: open -> closed
type: performance -> enhancement
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.10, - Python 3.9
2021-03-02 07:40:58berker.peksagsetnosy: + berker.peksag
messages: + msg387901
2020-02-09 20:14:08terry.reedysetnosy: + ghaering
2020-02-02 02:06:58alex.henriesetkeywords: + patch
stage: patch review
pull_requests: + pull_request17682
2020-02-02 02:05:21alex.henriecreate