From dd4b299df1589dea63f4067b5617869d7baa7e23 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 5 Nov 2013 14:30:11 +0100 Subject: Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, handle _pysqlite_fetch_one_row() failure --- Modules/_sqlite/cursor.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 @@ PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self) 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; + } } } -- cgit v0.12