Skip to content

Commit 8171580

Browse files
bpo-41638: Improve ProgrammingError message for absent parameter. (GH-21999)
It contains now the name of the parameter instead of its index when parameters are supplied as a dict.
1 parent 4b8032e commit 8171580

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:exc:`~sqlite3.ProgrammingError` message for absent parameter in :mod:`sqlite3`
2+
contains now the name of the parameter instead of its index when parameters
3+
are supplied as a dict.

Modules/_sqlite/statement.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
295295
Py_DECREF(binding_name_obj);
296296
if (!current_param) {
297297
if (!PyErr_Occurred() || PyErr_ExceptionMatches(PyExc_LookupError)) {
298-
PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
298+
PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding parameter :%s.", binding_name);
299299
}
300300
return;
301301
}

0 commit comments

Comments
 (0)