8000 gh-69093: improve sqlite3.Connection.blobopen() error handling (GH-91… · python/cpython@c06a4ff · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c06a4ff

Browse files
author
Erlend Egeberg Aasland
authored
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.
1 parent 1b34b56 commit c06a4ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/_sqlite/connection.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,11 @@ blobopen_impl(pysqlite_Connection *self, const char *table, const char *col,
475475
rc = sqlite3_blob_open(self->db, name, table, col, row, !readonly, &blob);
476476
Py_END_ALLOW_THREADS
477477

478-
if (rc 662D != SQLITE_OK) {
478+
if (rc == SQLITE_MISUSE) {
479+
PyErr_Format(self->state->InterfaceError, sqlite3_errstr(rc));
480+
return NULL;
481+
}
482+
else if (rc != SQLITE_OK) {
479483
_pysqlite_seterror(self->state, self->db);
480484
return NULL;
481485
}

0 commit comments

Comments
 (0)
0