]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41638: Improve ProgrammingError message for absent parameter. (GH-21999)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 4 Sep 2020 17:55:41 +0000 (20:55 +0300)
committerGitHub <noreply@github.com>
Fri, 4 Sep 2020 17:55:41 +0000 (20:55 +0300)
It contains now the name of the parameter instead of its index when parameters
are supplied as a dict.

Misc/NEWS.d/next/Library/2020-08-29-16-45-12.bpo-41638.iZfW5N.rst [new file with mode: 0644]
Modules/_sqlite/statement.c

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 (file)
index 0000000..8ab7b5e
--- /dev/null
@@ -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.
index 9de8f9b67228f5c13f6e402706d204061ab843e7..26599b423eb8b915177d83ea97231cb0428e296e 100644 (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;
             }