]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)
authorErlend Egeberg Aasland <erlend.aasland@innova.no>
Thu, 17 Mar 2022 05:58:25 +0000 (06:58 +0100)
committerGitHub <noreply@github.com>
Thu, 17 Mar 2022 05:58:25 +0000 (22:58 -0700)
commit4674fd4e938eb4a29ccd5b12c15455bd2a41c335
tree9b6d452caca59b4fa2e3eee150de2d3e098d73fa
parent96568e995d840c66edb25b6b9d85e4dcccf5a936
bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)

* Improve exception compliance with PEP 249
* Raise InterfaceError instead of ProgrammingError for SQLITE_MISUSE.
  If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the
  sqlite3 module are not responsible for using the SQLite C API correctly.
* Don't overwrite BufferError with ValueError when conversion to BLOB fails.
* Raise ProgrammingError instead of Warning if user tries to execute() more
  than one SQL statement.
* Raise ProgrammingError instead of ValueError if an SQL query contains null characters.
* Make sure `_pysqlite_set_result` raises an exception if it returns -1.
Lib/test/test_sqlite3/test_dbapi.py
Lib/test/test_sqlite3/test_regression.py
Lib/test/test_sqlite3/test_userfunctions.py
Misc/NEWS.d/next/Library/2021-08-10-00-05-53.bpo-44859.9e9_3V.rst [new file with mode: 0644]
Modules/_sqlite/connection.c
Modules/_sqlite/statement.c