diff options
author | Erlend E. Aasland <erlend@python.org> | 2024-05-14 16:10:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-14 16:10:55 (GMT) |
commit | d8e0e009195b2388fb53012c1f0fa786426dc05f (patch) | |
tree | bc19a0a25cf0bbd9f16214d053561a9053504c6c /Modules/_sqlite | |
parent | 7a97ee570f361af27c59eb883b53425fef11c739 (diff) | |
download | cpython-d8e0e009195b2388fb53012c1f0fa786426dc05f.zip cpython-d8e0e009195b2388fb53012c1f0fa786426dc05f.tar.gz cpython-d8e0e009195b2388fb53012c1f0fa786426dc05f.tar.bz2 |
gh-118928: sqlite3: disallow sequences of params with named placeholders (#118929)
Follow-up of gh-101693. The previous DeprecationWarning is replaced with
raising sqlite3.ProgrammingError.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r-- | Modules/_sqlite/cursor.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 950596e..5d4b77b 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -670,15 +670,11 @@ bind_parameters(pysqlite_state *state, pysqlite_Statement *self, 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)) { |