]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-122431: Correct the non-negative error message in `readline.append_history_...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 23 Dec 2025 04:59:43 +0000 (05:59 +0100)
committerGitHub <noreply@github.com>
Tue, 23 Dec 2025 04:59:43 +0000 (04:59 +0000)
gh-122431: Correct the non-negative error message in `readline.append_history_file` (GH-143075)

"positive" -> "non-negative", since zero is included.
(cherry picked from commit a273bc99d2ff853f59ee6da4d897b1be72a03975)

Co-authored-by: Zheng Yu <dataisland@outlook.com>
Misc/NEWS.d/next/Library/2025-12-22-22-36-21.gh-issue-122431.9E3085.rst [new file with mode: 0644]
Modules/readline.c

diff --git a/Misc/NEWS.d/next/Library/2025-12-22-22-36-21.gh-issue-122431.9E3085.rst b/Misc/NEWS.d/next/Library/2025-12-22-22-36-21.gh-issue-122431.9E3085.rst
new file mode 100644 (file)
index 0000000..8936ac9
--- /dev/null
@@ -0,0 +1 @@
+Corrected the error message in :func:`readline.append_history_file` to state that ``nelements`` must be non-negative instead of positive.
index 7d1f703f7dbddeaf152b18c55073307c83e34ab2..f9362c312de922e16b63a1eb24506aa0f1c6cb84 100644 (file)
@@ -353,7 +353,7 @@ readline_append_history_file_impl(PyObject *module, int nelements,
 {
     if (nelements < 0)
     {
-        PyErr_SetString(PyExc_ValueError, "nelements must be positive");
+        PyErr_SetString(PyExc_ValueError, "nelements must be non-negative");
         return NULL;
     }