Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd4b299

Browse files
committed
Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, handle
_pysqlite_fetch_one_row() failure
1 parent 6079814 commit dd4b299

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Modules/_sqlite/cursor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,12 @@ PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self)
891891

892892
if (rc == SQLITE_ROW) {
893893
self->next_row = _pysqlite_fetch_one_row(self);
894+
if (self->next_row == NULL) {
895+
(void)pysqlite_statement_reset(self->statement);
896+
Py_DECREF(next_row);
897+
_pysqlite_seterror(self->connection->db, NULL);
898+
return NULL;
899+
}
894900
}
895901
}
896902

0 commit comments

Comments
 (0)