This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Convert Python exceptions to appropriate SQLite error codes
Type: enhancement Stage: resolved
Components: Extension Modules Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, erlendaasland, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-08-05 11:54 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27613 closed serhiy.storchaka, 2021-08-05 12:05
Messages (3)
msg398997 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-08-05 11:54
Currently, any exception raised in user-defined function set the general SQLITE_ERROR error which then produce sqlite3.OperationalError.

For example, if the user function returns a string or bytes object larger than INT_MAX you get OperationalError, but if it is less than INT_MAX and larger than the SQLite limit (configurable, 1000000000 by default) you get DataError. If a memory error occurred in Python code you get OperationalError, but if it is occurred in the SQLite code you get MemoryError.

The proposed PR sets corresponding SQLite error codes for MemoryError and OverflowError in user-defined functions. They will produce MemoryError and DataError in Python.
msg398999 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-08-05 12:08
It was grown from bigmem tests for issue44822.
msg399121 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-08-06 18:28
New changeset 7d747f26e6cac9f6891d475f3443441ce947697b by Serhiy Storchaka in branch 'main':
bpo-44839: Raise more specific errors in sqlite3 (GH-27613)
https://github.com/python/cpython/commit/7d747f26e6cac9f6891d475f3443441ce947697b
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 89002
2021-08-06 18:29:14serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-08-06 18:28:56serhiy.storchakasetmessages: + msg399121
2021-08-05 12:08:57serhiy.storchakasetmessages: + msg398999
2021-08-05 12:05:11serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request26107
2021-08-05 11:54:52serhiy.storchakacreate