[Python-checkins] bpo-39523: Use do-while loop pysqlite_cursor_executescript() (GH-18305)

berkerpeksag webhook-mailer at python.org
Tue Mar 2 02:40:59 EST 2021


https://github.com/python/cpython/commit/25e244c92501e84b0fd6e7539e15c0e640d42cc1
commit: 25e244c92501e84b0fd6e7539e15c0e640d42cc1
branch: master
author: Alex Henrie <alexhenrie24 at gmail.com>
committer: berkerpeksag <berker.peksag at gmail.com>
date: 2021-03-02T09:40:34+02:00
summary:

bpo-39523: Use do-while loop pysqlite_cursor_executescript() (GH-18305)

files:
M Modules/_sqlite/cursor.c

diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index ddacb2745d34d..23ab7451fdaa0 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -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);



More information about the Python-checkins mailing list