[New-bugs-announce] [issue39523] Unnecessary variable assignment and initial loop check in pysqlite_cursor_executescript
Alex Henrie
report at bugs.python.org
Sat Feb 1 21:05:21 EST 2020
New submission from Alex Henrie <alexhenrie24 at gmail.com>:
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()) {
(void)sqlite3_finalize(statement);
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.
----------
components: Library (Lib)
messages: 361200
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Unnecessary variable assignment and initial loop check in pysqlite_cursor_executescript
type: performance
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39523>
_______________________________________
More information about the New-bugs-announce
mailing list