]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-129928: Rework sqlite3 error helpers (#129929)
authorErlend E. Aasland <erlend@python.org>
Tue, 11 Feb 2025 07:49:25 +0000 (08:49 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2025 07:49:25 +0000 (07:49 +0000)
commit3b366a4a4b0cea483824adbc2fa5a19d82d3dc6a
tree6db10c7a3e90a315c9bdba32e7f2c7811e19bc49
parent3a2e7aacf6f414bbbedaf072e7cb1b48e3d402fa
gh-129928: Rework sqlite3 error helpers (#129929)

Add a helper for raising DB-API compatible exceptions based on the
result code of SQLite C APIs. Some APIs do not store the error indicator
on the database pointer, so we need to be able to deduce the DB-API
compatible exception directly from the error code.

- rename _pysqlite_seterror() as set_error_from_db()
- introduce set_error_from_code()
Modules/_sqlite/blob.c
Modules/_sqlite/connection.c
Modules/_sqlite/cursor.c
Modules/_sqlite/statement.c
Modules/_sqlite/util.c
Modules/_sqlite/util.h