summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-06-23 12:56:40 (GMT)
committerGitHub <noreply@github.com>2021-06-23 12:56:40 (GMT)
commita50e28377bcf37121b55c2de70d95a5386c478f8 (patch)
tree10bd9512e7501dc798630a89770254be220d0905 /Modules/_sqlite/cursor.c
parent489699ca05bed5cfd10e847d8580840812b476cd (diff)
downloadcpython-a50e28377bcf37121b55c2de70d95a5386c478f8.zip
cpython-a50e28377bcf37121b55c2de70d95a5386c478f8.tar.gz
cpython-a50e28377bcf37121b55c2de70d95a5386c478f8.tar.bz2
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`.
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 8e7d65f..451742b 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -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;
}