Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-69093: improve sqlite3.Connection.blobopen() error handling #91571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2022

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Apr 15, 2022

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.

gh-69093

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.
@erlend-aasland
Copy link
Contributor Author

I noticed this comment in the sqlite3_blob_open docs:

Unless it returns SQLITE_MISUSE, this function sets the database connection error code and message accessible via sqlite3_errcode() and sqlite3_errmsg() and related functions.

_pysqlite_seterror uses the error code/message that is set on the connection object, so we need to handle the SQLITE_MISUSE case explicitly. Unfortunately (or luckily), there is no way for us to force such an error, so we cannot add a unit test for this.

@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Apr 15, 2022

This reminds me that we need to map SQLITE_MISUSE to InterfaceError iso. ProgrammingError. But that belongs to issue #89022.

UPDATE, see gh-91572.

@JelleZijlstra JelleZijlstra merged commit c06a4ff into python:main Apr 15, 2022
@erlend-aasland erlend-aasland deleted the sqlite-blob-misuse branch April 15, 2022 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants