[issue44859] Improve some sqlite3 errors

Erlend E. Aasland report at bugs.python.org
Sun Aug 8 16:52:03 EDT 2021


Erlend E. Aasland <erlend.aasland at innova.no> added the comment:

* sqlite3.ProgrammingError is raised for SQLITE_MISUSE. IMO, sqlite3.InterfaceError, is more appropriate.
* In case of too large integer values, OverflowError is raised on bind, but sqlite3.DataError is raised on UDF return. Using sqlite3.DataError in both cases would be more aligned with PEP 249.
* Too long strings/blobs raise OverflowError. Consider raising sqlite3.DataError instead.
* For non-contiguous (blob) buffers, we overwrite the BufferError with ValueError. Instead of overwriting BufferError, we should consider chaining with sqlite3.DataError.
* Consider raising sqlite3.Warning when nan is implicitly converted to NULL by SQLite
* In pysqlite_statement_create(), consider raising sqlite3.ProgrammingError iso. sqlite3.Warning when more than one statement is executed
* In pysqlite_statement_create(), consider raising sqlite3.DataError iso. ValueError for queries with null characters

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44859>
_______________________________________


More information about the Python-bugs-list mailing list