mirror of https://github.com/python/cpython
Fix for Issue2515: Don't crash when trying to fetch data from a closed cursor.
This commit is contained in:
parent
f122902f76
commit
a269762fb0
|
@ -851,15 +851,17 @@ PyObject* cursor_iternext(Cursor *self)
|
||||||
next_row = next_row_tuple;
|
next_row = next_row_tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
|
if (self->statement) {
|
||||||
if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
|
rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
|
||||||
Py_DECREF(next_row);
|
if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
|
||||||
_seterror(self->connection->db);
|
Py_DECREF(next_row);
|
||||||
return NULL;
|
_seterror(self->connection->db);
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (rc == SQLITE_ROW) {
|
if (rc == SQLITE_ROW) {
|
||||||
self->next_row = _fetch_one_row(self);
|
self->next_row = _fetch_one_row(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return next_row;
|
return next_row;
|
||||||
|
|
Loading…
Reference in New Issue