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.
This commit is contained in:
Serhiy Storchaka 2020-09-04 20:55:41 +03:00 committed by GitHub
parent 4b8032e5a4
commit 8171580871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,3 @@
:exc:`~sqlite3.ProgrammingError` message for absent parameter in :mod:`sqlite3`
contains now the name of the parameter instead of its index when parameters
are supplied as a dict.

View File

@ -295,7 +295,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
Py_DECREF(binding_name_obj);
if (!current_param) {
if (!PyErr_Occurred() || PyErr_ExceptionMatches(PyExc_LookupError)) {
PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding parameter :%s.", binding_name);
}
return;
}