mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-69093: improve sqlite3.Connection.blobopen() error handling (GH-91571)
Unless sqlite3_blob_open() returns SQLITE_MISUSE, the error code and message are available on the connection object. This means we have to handle SQLITE_MISUSE error messages explicitly.
This commit is contained in:
parent
1b34b5687b
commit
c06a4ffe81
1 changed files with 5 additions and 1 deletions
|
@ -475,7 +475,11 @@ blobopen_impl(pysqlite_Connection *self, const char *table, const char *col,
|
||||||
rc = sqlite3_blob_open(self->db, name, table, col, row, !readonly, &blob);
|
rc = sqlite3_blob_open(self->db, name, table, col, row, !readonly, &blob);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
if (rc != SQLITE_OK) {
|
if (rc == SQLITE_MISUSE) {
|
||||||
|
PyErr_Format(self->state->InterfaceError, sqlite3_errstr(rc));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else if (rc != SQLITE_OK) {
|
||||||
_pysqlite_seterror(self->state, self->db);
|
_pysqlite_seterror(self->state, self->db);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue