* Remove :data:`!version` and :data:`!version_info` from :mod:`sqlite3`.
(Contributed by Hugo van Kemenade in :gh:`118924`.)
+* Disallow using a sequence of parameters with named placeholders.
+ This had previously raised a :exc:`DeprecationWarning` since Python 3.12;
+ it will now raise a :exc:`sqlite3.ProgrammingError`.
+ (Contributed by Erlend E. Aasland in :gh:`118928` and :gh:`101693`.)
+
typing
------
msg = "Binding.*is a named parameter"
for query, params in dataset:
with self.subTest(query=query, params=params):
- with self.assertWarnsRegex(DeprecationWarning, msg) as cm:
+ with self.assertRaisesRegex(sqlite.ProgrammingError, msg) as cm:
self.cu.execute(query, params)
- self.assertEqual(cm.filename, __file__)
def test_execute_indexed_nameless_params(self):
# See gh-117995: "'?1' is considered a named placeholder"
--- /dev/null
+Disallow using a sequence of parameters with named placeholders in
+:mod:`sqlite3` queries. Patch by Erlend E. Aasland.
for (i = 0; i < num_params; i++) {
const char *name = sqlite3_bind_parameter_name(self->st, i+1);
if (name != NULL && name[0] != '?') {
- int ret = PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
+ PyErr_Format(state->ProgrammingError,
"Binding %d ('%s') is a named parameter, but you "
"supplied a sequence which requires nameless (qmark) "
- "placeholders. Starting with Python 3.14 an "
- "sqlite3.ProgrammingError will be raised.",
+ "placeholders.",
i+1, name);
- if (ret < 0) {
- return;
- }
}
if (PyTuple_CheckExact(parameters)) {