Skip to content

Commit

Permalink
bpo-39496: Remove redundant checks from _sqlite/cursor.c (GH-18270)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhenrie committed Feb 1, 2020
1 parent b94737a commit 78c7183
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()) {
Expand Down

0 comments on commit 78c7183

Please sign in to comment.