summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-09-04 17:55:41 (GMT)
committerGitHub <noreply@github.com>2020-09-04 17:55:41 (GMT)
commit81715808716198471fbca0a3db42ac408468dbc5 (patch)
tree841863059ef0d12191c84d52caf967cacf0440d4
parent4b8032e5a4994a7902076efa72fca1e2c85d8b7f (diff)
downloadcpython-81715808716198471fbca0a3db42ac408468dbc5.zip
cpython-81715808716198471fbca0a3db42ac408468dbc5.tar.gz
cpython-81715808716198471fbca0a3db42ac408468dbc5.tar.bz2
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.
-rw-r--r--Misc/NEWS.d/next/Library/2020-08-29-16-45-12.bpo-41638.iZfW5N.rst3
-rw-r--r--Modules/_sqlite/statement.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Library/2020-08-29-16-45-12.bpo-41638.iZfW5N.rst b/Misc/NEWS.d/next/Library/2020-08-29-16-45-12.bpo-41638.iZfW5N.rst
new file mode 100644
index 0000000..8ab7b5e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-08-29-16-45-12.bpo-41638.iZfW5N.rst
@@ -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.
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 9de8f9b..26599b4 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -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;
}