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 16f757feca3342..401a3a7072b846 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2873,7 +2873,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; }