Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/cursor.c @ 46322:fb5eaa4be700 2.5
Fix for Issue2515: Don't crash when trying to fetch data from a closed cursor.
| author | Gerhard Häring <gh@ghaering.de> |
|---|---|
| date | Sun, 06 Apr 2008 11:05:24 +0000 |
| parents | c4ac6ea497a1 |
| children | 68cf3cbb21d2 |
line wrap: on
line diff
--- a/Modules/_sqlite/cursor.c Tue Apr 01 23:59:06 2008 +0000 +++ b/Modules/_sqlite/cursor.c Sun Apr 06 11:05:24 2008 +0000 @@ -851,15 +851,17 @@ next_row = next_row_tuple; } - rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection); - if (rc != SQLITE_DONE && rc != SQLITE_ROW) { - Py_DECREF(next_row); - _seterror(self->connection->db); - return NULL; - } + if (self->statement) { + rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection); + if (rc != SQLITE_DONE && rc != SQLITE_ROW) { + Py_DECREF(next_row); + _seterror(self->connection->db); + return NULL; + } - if (rc == SQLITE_ROW) { - self->next_row = _fetch_one_row(self); + if (rc == SQLITE_ROW) { + self->next_row = _fetch_one_row(self); + } } return next_row;
