[Python-checkins] cpython: Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, when the row factory
victor.stinner
python-checkins at python.org
Tue Nov 5 18:08:02 CET 2013
http://hg.python.org/cpython/rev/374635037b0a
changeset: 86946:374635037b0a
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Nov 05 14:50:30 2013 +0100
summary:
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())
files:
Modules/_sqlite/cursor.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -871,10 +871,15 @@
}
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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list