summaryrefslogtreecommitdiff
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-05 14:30:11 +0100
committerVictor Stinner <victor.stinner@gmail.com>2013-11-05 14:30:11 +0100
commita20dfca1aaa022a56c4ab1bca4bcd7cd692109e8 (patch)
tree7a41eb7eb1bb693e08cb7156d8ace28a4daef12a /Modules/_sqlite/cursor.c
parent50f9ae2b565eb7e8046dd36916c551574b17d61a (diff)
downloadcpython-a20dfca1aaa022a56c4ab1bca4bcd7cd692109e8.tar.gz
Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, handle
_pysqlite_fetch_one_row() failure
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index bf4bbb4a28..cf7f9d3242 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;
+ }
}
}