diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-05 13:50:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-05 13:50:30 (GMT) |
commit | 85a12a8bebd20e86fa3931940d7e317fa392cfb8 (patch) | |
tree | c07d802346ef7512086a71d362d47fc6f7a9042d /Modules/_sqlite | |
parent | b3e1ef1ce0e4c81c43b3c49c0db9a3047d90280b (diff) | |
download | cpython-85a12a8bebd20e86fa3931940d7e317fa392cfb8.zip cpython-85a12a8bebd20e86fa3931940d7e317fa392cfb8.tar.gz cpython-85a12a8bebd20e86fa3931940d7e317fa392cfb8.tar.bz2 |
Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, when the row factory
fails, don't consume the row (restore it) and fail immediatly (don't call
pysqlite_step())
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r-- | Modules/_sqlite/cursor.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index cf7f9d3..8d10890 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -871,10 +871,15 @@ PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self) } next_row_tuple = self->next_row; + assert(next_row_tuple != NULL); self->next_row = NULL; if (self->row_factory != Py_None) { next_row = PyObject_CallFunction(self->row_factory, "OO", self, next_row_tuple); + if (next_row == NULL) { + self->next_row = next_row_tuple; + return NULL; + } Py_DECREF(next_row_tuple); } else { next_row = next_row_tuple; |