]> granicus.if.org Git - python/commitdiff
Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, handle
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 5 Nov 2013 13:30:11 +0000 (14:30 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 5 Nov 2013 13:30:11 +0000 (14:30 +0100)
_pysqlite_fetch_one_row() failure

Modules/_sqlite/cursor.c

index bf4bbb4a28577ce1404f22df42aa4597b9560f63..cf7f9d3242889a2b6e99a50de8ac74db43729c12 100644 (file)
@@ -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;
+            }
         }
     }