New submission from Alex Henrie <[email protected]>:
pysqlite_cursor_fetchall currently has the following bit of code:
/* just make sure we enter the loop */
row = (PyObject*)Py_None;
while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
}
}
This can and should be rewritten as a for loop to avoid the unnecessary
initialization to Py_None and the redundant if statement inside the loop.
pysqlite_cursor_fetchmany has the same problem.
----------
components: Library (Lib)
messages: 361006
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Inelegant loops in Modules/_sqlite/cursor.c
type: performance
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39496>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com