]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39523: Use do-while loop pysqlite_cursor_executescript() (GH-18305)
authorAlex Henrie <alexhenrie24@gmail.com>
Tue, 2 Mar 2021 07:40:34 +0000 (00:40 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Mar 2021 07:40:34 +0000 (09:40 +0200)
Modules/_sqlite/cursor.c

index ddacb2745d34d1092ac48ba68053b273a638b2de..23ab7451fdaa00d073e7067ad6b9ae46859fa788 100644 (file)
@@ -715,14 +715,13 @@ pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *script_obj)
         }
 
         /* execute statement, and ignore results of SELECT statements */
-        rc = SQLITE_ROW;
-        while (rc == SQLITE_ROW) {
+        do {
             rc = pysqlite_step(statement, self->connection);
             if (PyErr_Occurred()) {
                 (void)sqlite3_finalize(statement);
                 goto error;
             }
-        }
+        } while (rc == SQLITE_ROW);
 
         if (rc != SQLITE_DONE) {
             (void)sqlite3_finalize(statement);