From aee8c217bdbe46075b763f070cbc3fbc03f13939 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 23 Dec 2025 06:01:41 +0100 Subject: [PATCH] [3.14] gh-122431: Correct the non-negative error message in `readline.append_history_file` (GH-143075) (GH-143090) 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 --- .../next/Library/2025-12-22-22-36-21.gh-issue-122431.9E3085.rst | 1 + Modules/readline.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2025-12-22-22-36-21.gh-issue-122431.9E3085.rst 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 index 000000000000..8936ac9395f7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-22-22-36-21.gh-issue-122431.9E3085.rst @@ -0,0 +1 @@ +Corrected the error message in :func:`readline.append_history_file` to state that ``nelements`` must be non-negative instead of positive. diff --git a/Modules/readline.c b/Modules/readline.c index 4da66ca6e7b9..8475846eefc9 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -391,7 +391,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; } -- 2.47.3