You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Convert Python exceptions to appropriate SQLite error codes #89002
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.
Activity
serhiy-storchaka commentedon Aug 5, 2021
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.
serhiy-storchaka commentedon Aug 5, 2021
It was grown from bigmem tests for bpo-44822.
serhiy-storchaka commentedon Aug 6, 2021
New changeset 7d747f2 by Serhiy Storchaka in branch 'main':
bpo-44839: Raise more specific errors in sqlite3 (GH-27613)
7d747f2