diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2022-04-15 16:27:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-15 16:27:39 (GMT) |
commit | c06a4ffe818feddef3b5083d9746a1c0b82c84ab (patch) | |
tree | c7a3ab790eaae2fe34284bbbd74b212856875e29 /Modules | |
parent | 1b34b5687b20a54cff2158c8660201e7377dec21 (diff) | |
download | cpython-c06a4ffe818feddef3b5083d9746a1c0b82c84ab.zip cpython-c06a4ffe818feddef3b5083d9746a1c0b82c84ab.tar.gz cpython-c06a4ffe818feddef3b5083d9746a1c0b82c84ab.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sqlite/connection.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 85fb128..0028cf7 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -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); 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); return NULL; } |