Skip to content

Commit

Permalink
pythongh-118928: sqlite3: correctly bail if sequences of params are u…
Browse files Browse the repository at this point in the history
…sed with named placeholders

Fix up post pythongh-118929.
  • Loading branch information
erlend-aasland committed May 20, 2024
1 parent 0abf997 commit 4bde862
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix an error where incorrect bindings in :mod:`sqlite3` queries could lead
to a crash.
2 changes: 1 addition & 1 deletion Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ 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] != '?') {
PyErr_Format(state->ProgrammingError,
return PyErr_Format(state->ProgrammingError,
"Binding %d ('%s') is a named parameter, but you "
"supplied a sequence which requires nameless (qmark) "
"placeholders.",
Expand Down

0 comments on commit 4bde862

Please sign in to comment.