diff options
author | Erlend Egeberg Aasland <erlend.aasland@protonmail.com> | 2022-05-04 07:16:01 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 07:16:01 -0600 |
commit | 090819ec5faea2d0c2cdf6bcfdbbc9df144a8aad (patch) | |
tree | 71881b44e7ffb8eaa92dcdfc88a6ad037bc057d9 /Lib/test/test_sqlite3/test_dbapi.py | |
parent | d716a0dfe2d1029111db393afaecdb04cc4093de (diff) | |
download | cpython-090819ec5faea2d0c2cdf6bcfdbbc9df144a8aad.tar.gz cpython-090819ec5faea2d0c2cdf6bcfdbbc9df144a8aad.zip |
gh-89022: Improve sqlite3 exceptions related to binding params and API misuse (#91572)
* Map SQLITE_MISUSE to sqlite3.InterfaceError
SQLITE_MISUSE implies misuse of the SQLite C API, which, if it happens,
is _not_ a user error; it is an sqlite3 extension module error.
* Raise better errors when binding parameters fail.
Instead of always raising InterfaceError, guessing what went wrong,
raise accurate exceptions with more accurate error messages.
Diffstat (limited to 'Lib/test/test_sqlite3/test_dbapi.py')
-rw-r--r-- | Lib/test/test_sqlite3/test_dbapi.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 7e675a91b5d..e132fcdfb0e 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -743,7 +743,7 @@ class CursorTests(unittest.TestCase): self.assertEqual(row[0], "Hu\x00go") def test_execute_non_iterable(self): - with self.assertRaises(ValueError) as cm: + with self.assertRaises(sqlite.ProgrammingError) as cm: self.cu.execute("insert into test(id) values (?)", 42) self.assertEqual(str(cm.exception), 'parameters are of unsupported type') |