Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, handle
_pysqlite_fetch_one_row() failure
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index bf4bbb4..cf7f9d3 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -891,6 +891,12 @@
 
         if (rc == SQLITE_ROW) {
             self->next_row = _pysqlite_fetch_one_row(self);
+            if (self->next_row == NULL) {
+                (void)pysqlite_statement_reset(self->statement);
+                Py_DECREF(next_row);
+                _pysqlite_seterror(self->connection->db, NULL);
+                return NULL;
+            }
         }
     }