bpo-39496: Remove redundant checks from _sqlite/cursor.c (GH-18270)

This commit is contained in:
Alex Henrie 2020-02-01 13:45:34 -07:00 committed by GitHub
parent b94737a4af
commit 78c7183f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 20 deletions

View File

@ -786,17 +786,9 @@ PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObj
return NULL;
}
/* just make sure we enter the loop */
row = Py_None;
while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
} else {
break;
}
while ((row = pysqlite_cursor_iternext(self))) {
PyList_Append(list, row);
Py_XDECREF(row);
if (++counter == maxrows) {
break;
@ -821,15 +813,9 @@ PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
return NULL;
}
/* 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);
}
while ((row = pysqlite_cursor_iternext(self))) {
PyList_Append(list, row);
Py_XDECREF(row);
}
if (PyErr_Occurred()) {