From ebc8655982aee94697d416ff7c8606d1c4c9f3fd Mon Sep 17 00:00:00 2001 From: Christian Veenhuis <124370897+ChVeen@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:31:05 +0200 Subject: [PATCH] gh-132527: Added missing `w` typecode to array() error message (GH-132529) (cherry picked from commit 52454c5d59c50147233f4229497a655e6e8c8408) Co-authored-by: Christian Veenhuis <124370897+ChVeen@users.noreply.github.com> Co-authored-by: Terry Jan Reedy Co-authored-by: Tomas R. --- .../next/Library/2025-04-14-23-00-00.gh-issue-132527.kTi8T7.rst | 1 + Modules/arraymodule.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2025-04-14-23-00-00.gh-issue-132527.kTi8T7.rst diff --git a/Misc/NEWS.d/next/Library/2025-04-14-23-00-00.gh-issue-132527.kTi8T7.rst b/Misc/NEWS.d/next/Library/2025-04-14-23-00-00.gh-issue-132527.kTi8T7.rst new file mode 100644 index 00000000000000..997cc2b784f7e6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-04-14-23-00-00.gh-issue-132527.kTi8T7.rst @@ -0,0 +1 @@ +Include the valid typecode 'w' in the error message when an invalid typecode is passed to :class:`array.array`. diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 600302e1183f99..62a3cca1e948ba 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2840,7 +2840,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } } PyErr_SetString(PyExc_ValueError, - "bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)"); + "bad typecode (must be b, B, u, w, h, H, i, I, l, L, q, Q, f or d)"); return NULL; }