bpo-42064: Move sqlite3 exceptions to global state, part 1 of 2 (GH-26745)

Also adds a test to verify the (borrowed) exceptions in `sqlite3.Connection`.
This commit is contained in:
Erlend Egeberg Aasland 2021-06-23 14:56:40 +02:00 committed by GitHub
parent 489699ca05
commit a50e28377b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 48 deletions

View file

@ -272,7 +272,8 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
PyObject* error_msg;
if (self->reset) {
PyErr_SetString(pysqlite_InterfaceError, errmsg_fetch_across_rollback);
PyObject *exc = self->connection->InterfaceError;
PyErr_SetString(exc, errmsg_fetch_across_rollback);
return NULL;
}
@ -822,7 +823,8 @@ pysqlite_cursor_iternext(pysqlite_Cursor *self)
}
if (self->reset) {
PyErr_SetString(pysqlite_InterfaceError, errmsg_fetch_across_rollback);
PyObject *exc = self->connection->InterfaceError;
PyErr_SetString(exc, errmsg_fetch_across_rollback);
return NULL;
}