[Python-checkins] [3.8] bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593). (GH-15599)

Serhiy Storchaka webhook-mailer at python.org
Thu Aug 29 11:30:04 EDT 2019


https://github.com/python/cpython/commit/96631dcb11c2786f470d4586bf23ecca14361506
commit: 96631dcb11c2786f470d4586bf23ecca14361506
branch: 3.8
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-08-29T18:29:59+03:00
summary:

[3.8] bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593). (GH-15599)

(cherry picked from commit 4901fe274bc82b95dc89bcb3de8802a3dfedab32)

Co-authored-by: Rémi Lapeyre <remi.lapeyre at henki.fr>

files:
A Misc/NEWS.d/next/Tools-Demos/2019-05-27-16-13-08.bpo-37034.zbTgy8.rst
M Include/modsupport.h
M Lib/test/clinic.test
M Lib/test/test_pyexpat.py
M Modules/_blake2/clinic/blake2b_impl.c.h
M Modules/_blake2/clinic/blake2s_impl.c.h
M Modules/_io/clinic/_iomodule.c.h
M Modules/_io/clinic/bufferedio.c.h
M Modules/_io/clinic/bytesio.c.h
M Modules/_io/clinic/fileio.c.h
M Modules/_io/clinic/textio.c.h
M Modules/_io/clinic/winconsoleio.c.h
M Modules/_multiprocessing/clinic/posixshmem.c.h
M Modules/cjkcodecs/clinic/multibytecodec.c.h
M Modules/clinic/_bz2module.c.h
M Modules/clinic/_codecsmodule.c.h
M Modules/clinic/_cryptmodule.c.h
M Modules/clinic/_curses_panel.c.h
M Modules/clinic/_cursesmodule.c.h
M Modules/clinic/_dbmmodule.c.h
M Modules/clinic/_elementtree.c.h
M Modules/clinic/_gdbmmodule.c.h
M Modules/clinic/_hashopenssl.c.h
M Modules/clinic/_lzmamodule.c.h
M Modules/clinic/_pickle.c.h
M Modules/clinic/_sre.c.h
M Modules/clinic/_ssl.c.h
M Modules/clinic/_struct.c.h
M Modules/clinic/_tkinter.c.h
M Modules/clinic/_weakref.c.h
M Modules/clinic/arraymodule.c.h
M Modules/clinic/audioop.c.h
M Modules/clinic/binascii.c.h
M Modules/clinic/grpmodule.c.h
M Modules/clinic/itertoolsmodule.c.h
M Modules/clinic/posixmodule.c.h
M Modules/clinic/pwdmodule.c.h
M Modules/clinic/pyexpat.c.h
M Modules/clinic/signalmodule.c.h
M Modules/clinic/spwdmodule.c.h
M Modules/clinic/symtablemodule.c.h
M Modules/clinic/unicodedata.c.h
M Modules/clinic/zlibmodule.c.h
M Objects/clinic/bytearrayobject.c.h
M Objects/clinic/bytesobject.c.h
M Objects/clinic/codeobject.c.h
M Objects/clinic/floatobject.c.h
M Objects/clinic/funcobject.c.h
M Objects/clinic/longobject.c.h
M Objects/clinic/moduleobject.c.h
M Objects/clinic/typeobject.c.h
M Objects/clinic/unicodeobject.c.h
M Objects/stringlib/clinic/transmogrify.h.h
M PC/clinic/_testconsole.c.h
M PC/clinic/msvcrtmodule.c.h
M Python/clinic/bltinmodule.c.h
M Python/clinic/import.c.h
M Python/clinic/marshal.c.h
M Python/clinic/sysmodule.c.h
M Python/clinic/traceback.c.h
M Python/getargs.c
M Tools/clinic/clinic.py

diff --git a/Include/modsupport.h b/Include/modsupport.h
index 66a5ec839e2a..f90ede4831e3 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -66,7 +66,7 @@ PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
 #define _PyArg_NoPositional(funcname, args) \
     ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
 
-PyAPI_FUNC(void) _PyArg_BadArgument(const char *, int, const char *, PyObject *);
+PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *);
 PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
                                        Py_ssize_t, Py_ssize_t);
 #define _PyArg_CheckPositional(funcname, nargs, min, max) \
diff --git a/Lib/test/clinic.test b/Lib/test/clinic.test
index ac6f419c0d3a..f9c55e2a577f 100644
--- a/Lib/test/clinic.test
+++ b/Lib/test/clinic.test
@@ -44,7 +44,7 @@ test_object_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("test_object_converter", 3, "str", args[2]);
+        _PyArg_BadArgument("test_object_converter", "argument 3", "str", args[2]);
         goto exit;
     }
     c = args[2];
@@ -58,7 +58,7 @@ exit:
 static PyObject *
 test_object_converter_impl(PyObject *module, PyObject *a, PyObject *b,
                            PyObject *c, PyUnicode_Object *d)
-/*[clinic end generated code: output=f2c26174b3d46e94 input=005e6a8a711a869b]*/
+/*[clinic end generated code: output=a78312d933df9ea1 input=005e6a8a711a869b]*/
 
 
 /*[clinic input]
@@ -180,52 +180,52 @@ test_object_converter_subclass_of(PyObject *module, PyObject *const *args, Py_ss
         goto exit;
     }
     if (!PyLong_Check(args[0])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 1, "int", args[0]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 1", "int", args[0]);
         goto exit;
     }
     a = args[0];
     if (!PyTuple_Check(args[1])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 2, "tuple", args[1]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 2", "tuple", args[1]);
         goto exit;
     }
     b = args[1];
     if (!PyList_Check(args[2])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 3, "list", args[2]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 3", "list", args[2]);
         goto exit;
     }
     c = args[2];
     if (!PySet_Check(args[3])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 4, "set", args[3]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 4", "set", args[3]);
         goto exit;
     }
     d = args[3];
     if (!PyFrozenSet_Check(args[4])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 5, "frozenset", args[4]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 5", "frozenset", args[4]);
         goto exit;
     }
     e = args[4];
     if (!PyDict_Check(args[5])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 6, "dict", args[5]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 6", "dict", args[5]);
         goto exit;
     }
     f = args[5];
     if (!PyUnicode_Check(args[6])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 7, "str", args[6]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 7", "str", args[6]);
         goto exit;
     }
     g = args[6];
     if (!PyBytes_Check(args[7])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 8, "bytes", args[7]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 8", "bytes", args[7]);
         goto exit;
     }
     h = args[7];
     if (!PyByteArray_Check(args[8])) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 9, "bytearray", args[8]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 9", "bytearray", args[8]);
         goto exit;
     }
     i = args[8];
     if (!PyObject_TypeCheck(args[9], &MyType)) {
-        _PyArg_BadArgument("test_object_converter_subclass_of", 10, (&MyType)->tp_name, args[9]);
+        _PyArg_BadArgument("test_object_converter_subclass_of", "argument 10", (&MyType)->tp_name, args[9]);
         goto exit;
     }
     j = args[9];
@@ -240,7 +240,7 @@ test_object_converter_subclass_of_impl(PyObject *module, PyObject *a,
                                        PyObject *b, PyObject *c, PyObject *d,
                                        PyObject *e, PyObject *f, PyObject *g,
                                        PyObject *h, PyObject *i, PyObject *j)
-/*[clinic end generated code: output=99691bda8eeda6d6 input=31b06b772d5f983e]*/
+/*[clinic end generated code: output=dcf7772bf0c876dd input=31b06b772d5f983e]*/
 
 
 /*[clinic input]
@@ -269,7 +269,7 @@ test_PyBytesObject_converter(PyObject *module, PyObject *arg)
     PyBytesObject *a;
 
     if (!PyBytes_Check(arg)) {
-        _PyArg_BadArgument("test_PyBytesObject_converter", 0, "bytes", arg);
+        _PyArg_BadArgument("test_PyBytesObject_converter", "argument", "bytes", arg);
         goto exit;
     }
     a = (PyBytesObject *)arg;
@@ -281,7 +281,7 @@ exit:
 
 static PyObject *
 test_PyBytesObject_converter_impl(PyObject *module, PyBytesObject *a)
-/*[clinic end generated code: output=5d9a301c1df24eb5 input=12b10c7cb5750400]*/
+/*[clinic end generated code: output=7539d628e6fceace input=12b10c7cb5750400]*/
 
 
 /*[clinic input]
@@ -310,7 +310,7 @@ test_PyByteArrayObject_converter(PyObject *module, PyObject *arg)
     PyByteArrayObject *a;
 
     if (!PyByteArray_Check(arg)) {
-        _PyArg_BadArgument("test_PyByteArrayObject_converter", 0, "bytearray", arg);
+        _PyArg_BadArgument("test_PyByteArrayObject_converter", "argument", "bytearray", arg);
         goto exit;
     }
     a = (PyByteArrayObject *)arg;
@@ -322,7 +322,7 @@ exit:
 
 static PyObject *
 test_PyByteArrayObject_converter_impl(PyObject *module, PyByteArrayObject *a)
-/*[clinic end generated code: output=9455d06f4f09637b input=5a657da535d194ae]*/
+/*[clinic end generated code: output=1245af9f5b3e355e input=5a657da535d194ae]*/
 
 
 /*[clinic input]
@@ -351,7 +351,7 @@ test_unicode_converter(PyObject *module, PyObject *arg)
     PyObject *a;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("test_unicode_converter", 0, "str", arg);
+        _PyArg_BadArgument("test_unicode_converter", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -366,7 +366,7 @@ exit:
 
 static PyObject *
 test_unicode_converter_impl(PyObject *module, PyObject *a)
-/*[clinic end generated code: output=9275c04fe204f4c5 input=aa33612df92aa9c5]*/
+/*[clinic end generated code: output=18f1e3880c862611 input=aa33612df92aa9c5]*/
 
 
 /*[clinic input]
@@ -507,7 +507,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         a = PyByteArray_AS_STRING(args[0])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 1, "a byte string of length 1", args[0]);
+        _PyArg_BadArgument("test_char_converter", "argument 1", "a byte string of length 1", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -520,7 +520,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         b = PyByteArray_AS_STRING(args[1])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 2, "a byte string of length 1", args[1]);
+        _PyArg_BadArgument("test_char_converter", "argument 2", "a byte string of length 1", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -533,7 +533,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         c = PyByteArray_AS_STRING(args[2])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 3, "a byte string of length 1", args[2]);
+        _PyArg_BadArgument("test_char_converter", "argument 3", "a byte string of length 1", args[2]);
         goto exit;
     }
     if (nargs < 4) {
@@ -546,7 +546,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         d = PyByteArray_AS_STRING(args[3])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 4, "a byte string of length 1", args[3]);
+        _PyArg_BadArgument("test_char_converter", "argument 4", "a byte string of length 1", args[3]);
         goto exit;
     }
     if (nargs < 5) {
@@ -559,7 +559,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         e = PyByteArray_AS_STRING(args[4])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 5, "a byte string of length 1", args[4]);
+        _PyArg_BadArgument("test_char_converter", "argument 5", "a byte string of length 1", args[4]);
         goto exit;
     }
     if (nargs < 6) {
@@ -572,7 +572,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         f = PyByteArray_AS_STRING(args[5])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 6, "a byte string of length 1", args[5]);
+        _PyArg_BadArgument("test_char_converter", "argument 6", "a byte string of length 1", args[5]);
         goto exit;
     }
     if (nargs < 7) {
@@ -585,7 +585,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         g = PyByteArray_AS_STRING(args[6])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 7, "a byte string of length 1", args[6]);
+        _PyArg_BadArgument("test_char_converter", "argument 7", "a byte string of length 1", args[6]);
         goto exit;
     }
     if (nargs < 8) {
@@ -598,7 +598,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         h = PyByteArray_AS_STRING(args[7])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 8, "a byte string of length 1", args[7]);
+        _PyArg_BadArgument("test_char_converter", "argument 8", "a byte string of length 1", args[7]);
         goto exit;
     }
     if (nargs < 9) {
@@ -611,7 +611,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         i = PyByteArray_AS_STRING(args[8])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 9, "a byte string of length 1", args[8]);
+        _PyArg_BadArgument("test_char_converter", "argument 9", "a byte string of length 1", args[8]);
         goto exit;
     }
     if (nargs < 10) {
@@ -624,7 +624,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         j = PyByteArray_AS_STRING(args[9])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 10, "a byte string of length 1", args[9]);
+        _PyArg_BadArgument("test_char_converter", "argument 10", "a byte string of length 1", args[9]);
         goto exit;
     }
     if (nargs < 11) {
@@ -637,7 +637,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         k = PyByteArray_AS_STRING(args[10])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 11, "a byte string of length 1", args[10]);
+        _PyArg_BadArgument("test_char_converter", "argument 11", "a byte string of length 1", args[10]);
         goto exit;
     }
     if (nargs < 12) {
@@ -650,7 +650,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         l = PyByteArray_AS_STRING(args[11])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 12, "a byte string of length 1", args[11]);
+        _PyArg_BadArgument("test_char_converter", "argument 12", "a byte string of length 1", args[11]);
         goto exit;
     }
     if (nargs < 13) {
@@ -663,7 +663,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         m = PyByteArray_AS_STRING(args[12])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 13, "a byte string of length 1", args[12]);
+        _PyArg_BadArgument("test_char_converter", "argument 13", "a byte string of length 1", args[12]);
         goto exit;
     }
     if (nargs < 14) {
@@ -676,7 +676,7 @@ test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         n = PyByteArray_AS_STRING(args[13])[0];
     }
     else {
-        _PyArg_BadArgument("test_char_converter", 14, "a byte string of length 1", args[13]);
+        _PyArg_BadArgument("test_char_converter", "argument 14", "a byte string of length 1", args[13]);
         goto exit;
     }
 skip_optional:
@@ -690,7 +690,7 @@ static PyObject *
 test_char_converter_impl(PyObject *module, char a, char b, char c, char d,
                          char e, char f, char g, char h, char i, char j,
                          char k, char l, char m, char n)
-/*[clinic end generated code: output=e041d687555e0a5d input=e42330417a44feac]*/
+/*[clinic end generated code: output=9d3aaf5d6857ec9e input=e42330417a44feac]*/
 
 
 /*[clinic input]
@@ -1009,14 +1009,14 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("test_int_converter", 3, "a unicode character", args[2]);
+        _PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
         goto exit;
     }
     if (PyUnicode_READY(args[2])) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(args[2]) != 1) {
-        _PyArg_BadArgument("test_int_converter", 3, "a unicode character", args[2]);
+        _PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
         goto exit;
     }
     c = PyUnicode_READ_CHAR(args[2], 0);
@@ -1041,7 +1041,7 @@ exit:
 
 static PyObject *
 test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d)
-/*[clinic end generated code: output=de74e24e85a669a5 input=d20541fc1ca0553e]*/
+/*[clinic end generated code: output=10a2e48a34af5d7a input=d20541fc1ca0553e]*/
 
 
 /*[clinic input]
@@ -1215,7 +1215,7 @@ test_unsigned_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t
         goto skip_optional;
     }
     if (!PyLong_Check(args[2])) {
-        _PyArg_BadArgument("test_unsigned_long_converter", 3, "int", args[2]);
+        _PyArg_BadArgument("test_unsigned_long_converter", "argument 3", "int", args[2]);
         goto exit;
     }
     c = PyLong_AsUnsignedLongMask(args[2]);
@@ -1229,7 +1229,7 @@ exit:
 static PyObject *
 test_unsigned_long_converter_impl(PyObject *module, unsigned long a,
                                   unsigned long b, unsigned long c)
-/*[clinic end generated code: output=1c05c871c0309e08 input=f450d94cae1ef73b]*/
+/*[clinic end generated code: output=87c6b29fa217026e input=f450d94cae1ef73b]*/
 
 
 /*[clinic input]
@@ -1335,7 +1335,7 @@ test_unsigned_long_long_converter(PyObject *module, PyObject *const *args, Py_ss
         goto skip_optional;
     }
     if (!PyLong_Check(args[2])) {
-        _PyArg_BadArgument("test_unsigned_long_long_converter", 3, "int", args[2]);
+        _PyArg_BadArgument("test_unsigned_long_long_converter", "argument 3", "int", args[2]);
         goto exit;
     }
     c = PyLong_AsUnsignedLongLongMask(args[2]);
@@ -1351,7 +1351,7 @@ test_unsigned_long_long_converter_impl(PyObject *module,
                                        unsigned long long a,
                                        unsigned long long b,
                                        unsigned long long c)
-/*[clinic end generated code: output=0a9b17fb824e28eb input=a15115dc41866ff4]*/
+/*[clinic end generated code: output=aad2c7b43db2f190 input=a15115dc41866ff4]*/
 
 
 /*[clinic input]
@@ -3207,3 +3207,56 @@ test_posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
                                               PyObject *d, PyObject *e,
                                               PyObject *f)
 /*[clinic end generated code: output=719e4f6c224402d4 input=9914857713c5bbf8]*/
+
+/*[clinic input]
+test_keyword_only_parameter
+
+
+    *
+    co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
+
+[clinic start generated code]*/
+
+PyDoc_STRVAR(test_keyword_only_parameter__doc__,
+"test_keyword_only_parameter($module, /, *, co_lnotab=None)\n"
+"--\n"
+"\n");
+
+#define TEST_KEYWORD_ONLY_PARAMETER_METHODDEF    \
+    {"test_keyword_only_parameter", (PyCFunction)(void(*)(void))test_keyword_only_parameter, METH_FASTCALL|METH_KEYWORDS, test_keyword_only_parameter__doc__},
+
+static PyObject *
+test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab);
+
+static PyObject *
+test_keyword_only_parameter(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"co_lnotab", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "test_keyword_only_parameter", 0};
+    PyObject *argsbuf[1];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    PyBytesObject *co_lnotab = (PyBytesObject *)self->co_lnotab;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    if (!PyBytes_Check(args[0])) {
+        _PyArg_BadArgument("test_keyword_only_parameter", "argument 'co_lnotab'", "bytes", args[0]);
+        goto exit;
+    }
+    co_lnotab = (PyBytesObject *)args[0];
+skip_optional_kwonly:
+    return_value = test_keyword_only_parameter_impl(module, co_lnotab);
+
+exit:
+    return return_value;
+}
+
+static PyObject *
+test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab)
+/*[clinic end generated code: output=f25914b402039493 input=303df5046c7e37a3]*/
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 92fffc45f30a..2b6c2d20e746 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -285,7 +285,7 @@ def test_illegal(self):
             self.fail()
         except TypeError as e:
             self.assertEqual(str(e),
-                'ParserCreate() argument 2 must be str or None, not int')
+                "ParserCreate() argument 'namespace_separator' must be str or None, not int")
 
         try:
             expat.ParserCreate(namespace_separator='too long')
diff --git a/Misc/NEWS.d/next/Tools-Demos/2019-05-27-16-13-08.bpo-37034.zbTgy8.rst b/Misc/NEWS.d/next/Tools-Demos/2019-05-27-16-13-08.bpo-37034.zbTgy8.rst
new file mode 100644
index 000000000000..3457789635b4
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2019-05-27-16-13-08.bpo-37034.zbTgy8.rst
@@ -0,0 +1,2 @@
+Argument Clinic now uses the argument name on errors with keyword-only
+argument instead of their position. Patch contributed by Rémi Lapeyre.
diff --git a/Modules/_blake2/clinic/blake2b_impl.c.h b/Modules/_blake2/clinic/blake2b_impl.c.h
index 09fe00457f35..cd329c07c999 100644
--- a/Modules/_blake2/clinic/blake2b_impl.c.h
+++ b/Modules/_blake2/clinic/blake2b_impl.c.h
@@ -72,7 +72,7 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&key, 'C')) {
-            _PyArg_BadArgument("blake2b", 3, "contiguous buffer", fastargs[2]);
+            _PyArg_BadArgument("blake2b", "argument 'key'", "contiguous buffer", fastargs[2]);
             goto exit;
         }
         if (!--noptargs) {
@@ -84,7 +84,7 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&salt, 'C')) {
-            _PyArg_BadArgument("blake2b", 4, "contiguous buffer", fastargs[3]);
+            _PyArg_BadArgument("blake2b", "argument 'salt'", "contiguous buffer", fastargs[3]);
             goto exit;
         }
         if (!--noptargs) {
@@ -96,7 +96,7 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&person, 'C')) {
-            _PyArg_BadArgument("blake2b", 5, "contiguous buffer", fastargs[4]);
+            _PyArg_BadArgument("blake2b", "argument 'person'", "contiguous buffer", fastargs[4]);
             goto exit;
         }
         if (!--noptargs) {
@@ -261,4 +261,4 @@ _blake2_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
 {
     return _blake2_blake2b_hexdigest_impl(self);
 }
-/*[clinic end generated code: output=a91d182ce1109f34 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=cbb625d7f60c288c input=a9049054013a1b77]*/
diff --git a/Modules/_blake2/clinic/blake2s_impl.c.h b/Modules/_blake2/clinic/blake2s_impl.c.h
index 92739a1feb32..560bd68160b0 100644
--- a/Modules/_blake2/clinic/blake2s_impl.c.h
+++ b/Modules/_blake2/clinic/blake2s_impl.c.h
@@ -72,7 +72,7 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&key, 'C')) {
-            _PyArg_BadArgument("blake2s", 3, "contiguous buffer", fastargs[2]);
+            _PyArg_BadArgument("blake2s", "argument 'key'", "contiguous buffer", fastargs[2]);
             goto exit;
         }
         if (!--noptargs) {
@@ -84,7 +84,7 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&salt, 'C')) {
-            _PyArg_BadArgument("blake2s", 4, "contiguous buffer", fastargs[3]);
+            _PyArg_BadArgument("blake2s", "argument 'salt'", "contiguous buffer", fastargs[3]);
             goto exit;
         }
         if (!--noptargs) {
@@ -96,7 +96,7 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&person, 'C')) {
-            _PyArg_BadArgument("blake2s", 5, "contiguous buffer", fastargs[4]);
+            _PyArg_BadArgument("blake2s", "argument 'person'", "contiguous buffer", fastargs[4]);
             goto exit;
         }
         if (!--noptargs) {
@@ -261,4 +261,4 @@ _blake2_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
 {
     return _blake2_blake2s_hexdigest_impl(self);
 }
-/*[clinic end generated code: output=ae8e9b7301d092b4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=39af5a74c8805b36 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h
index 00ad616b41fe..1a9651d34081 100644
--- a/Modules/_io/clinic/_iomodule.c.h
+++ b/Modules/_io/clinic/_iomodule.c.h
@@ -161,7 +161,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
     }
     if (args[1]) {
         if (!PyUnicode_Check(args[1])) {
-            _PyArg_BadArgument("open", 2, "str", args[1]);
+            _PyArg_BadArgument("open", "argument 'mode'", "str", args[1]);
             goto exit;
         }
         Py_ssize_t mode_length;
@@ -207,7 +207,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
             }
         }
         else {
-            _PyArg_BadArgument("open", 4, "str or None", args[3]);
+            _PyArg_BadArgument("open", "argument 'encoding'", "str or None", args[3]);
             goto exit;
         }
         if (!--noptargs) {
@@ -230,7 +230,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
             }
         }
         else {
-            _PyArg_BadArgument("open", 5, "str or None", args[4]);
+            _PyArg_BadArgument("open", "argument 'errors'", "str or None", args[4]);
             goto exit;
         }
         if (!--noptargs) {
@@ -253,7 +253,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
             }
         }
         else {
-            _PyArg_BadArgument("open", 6, "str or None", args[5]);
+            _PyArg_BadArgument("open", "argument 'newline'", "str or None", args[5]);
             goto exit;
         }
         if (!--noptargs) {
@@ -311,7 +311,7 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("open_code", 1, "str", args[0]);
+        _PyArg_BadArgument("open_code", "argument 'path'", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -323,4 +323,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=d479285078750d68 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h
index d5e8c8a74813..72841fcb6779 100644
--- a/Modules/_io/clinic/bufferedio.c.h
+++ b/Modules/_io/clinic/bufferedio.c.h
@@ -21,11 +21,11 @@ _io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io__BufferedIOBase_readinto_impl(self, &buffer);
@@ -58,11 +58,11 @@ _io__BufferedIOBase_readinto1(PyObject *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto1", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto1", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer);
@@ -243,11 +243,11 @@ _io__Buffered_readinto(buffered *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io__Buffered_readinto_impl(self, &buffer);
@@ -280,11 +280,11 @@ _io__Buffered_readinto1(buffered *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto1", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto1", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io__Buffered_readinto1_impl(self, &buffer);
@@ -538,7 +538,7 @@ _io_BufferedWriter_write(buffered *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("write", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io_BufferedWriter_write_impl(self, &buffer);
@@ -672,4 +672,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=b22b4aedd53c340a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7246104f6c7d3167 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h
index 8dd68f56137f..83cd490dc598 100644
--- a/Modules/_io/clinic/bytesio.c.h
+++ b/Modules/_io/clinic/bytesio.c.h
@@ -319,11 +319,11 @@ _io_BytesIO_readinto(bytesio *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io_BytesIO_readinto_impl(self, &buffer);
@@ -515,4 +515,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=22e8fb54874b6ee5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4ec2506def9c8eb9 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h
index 8016e9888624..64addde57f3e 100644
--- a/Modules/_io/clinic/fileio.c.h
+++ b/Modules/_io/clinic/fileio.c.h
@@ -70,7 +70,7 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
     }
     if (fastargs[1]) {
         if (!PyUnicode_Check(fastargs[1])) {
-            _PyArg_BadArgument("FileIO", 2, "str", fastargs[1]);
+            _PyArg_BadArgument("FileIO", "argument 'mode'", "str", fastargs[1]);
             goto exit;
         }
         Py_ssize_t mode_length;
@@ -200,11 +200,11 @@ _io_FileIO_readinto(fileio *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io_FileIO_readinto_impl(self, &buffer);
@@ -303,7 +303,7 @@ _io_FileIO_write(fileio *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&b, 'C')) {
-        _PyArg_BadArgument("write", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io_FileIO_write_impl(self, &b);
@@ -447,4 +447,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
 #ifndef _IO_FILEIO_TRUNCATE_METHODDEF
     #define _IO_FILEIO_TRUNCATE_METHODDEF
 #endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
-/*[clinic end generated code: output=7ee4f3ae584fc6d2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a7e9cca3613660fb input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h
index cec9defea025..b8b507543ea8 100644
--- a/Modules/_io/clinic/textio.c.h
+++ b/Modules/_io/clinic/textio.c.h
@@ -229,7 +229,7 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
             }
         }
         else {
-            _PyArg_BadArgument("TextIOWrapper", 2, "str or None", fastargs[1]);
+            _PyArg_BadArgument("TextIOWrapper", "argument 'encoding'", "str or None", fastargs[1]);
             goto exit;
         }
         if (!--noptargs) {
@@ -258,7 +258,7 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
             }
         }
         else {
-            _PyArg_BadArgument("TextIOWrapper", 4, "str or None", fastargs[3]);
+            _PyArg_BadArgument("TextIOWrapper", "argument 'newline'", "str or None", fastargs[3]);
             goto exit;
         }
         if (!--noptargs) {
@@ -401,7 +401,7 @@ _io_TextIOWrapper_write(textio *self, PyObject *arg)
     PyObject *text;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("write", 0, "str", arg);
+        _PyArg_BadArgument("write", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -701,4 +701,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
 {
     return _io_TextIOWrapper_close_impl(self);
 }
-/*[clinic end generated code: output=b651e056e3000f88 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/winconsoleio.c.h b/Modules/_io/clinic/winconsoleio.c.h
index bb0cdc4558dd..3e501a585371 100644
--- a/Modules/_io/clinic/winconsoleio.c.h
+++ b/Modules/_io/clinic/winconsoleio.c.h
@@ -69,7 +69,7 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
     }
     if (fastargs[1]) {
         if (!PyUnicode_Check(fastargs[1])) {
-            _PyArg_BadArgument("_WindowsConsoleIO", 2, "str", fastargs[1]);
+            _PyArg_BadArgument("_WindowsConsoleIO", "argument 'mode'", "str", fastargs[1]);
             goto exit;
         }
         Py_ssize_t mode_length;
@@ -200,11 +200,11 @@ _io__WindowsConsoleIO_readinto(winconsoleio *self, PyObject *arg)
 
     if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
         PyErr_Clear();
-        _PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
+        _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io__WindowsConsoleIO_readinto_impl(self, &buffer);
@@ -313,7 +313,7 @@ _io__WindowsConsoleIO_write(winconsoleio *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&b, 'C')) {
-        _PyArg_BadArgument("write", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _io__WindowsConsoleIO_write_impl(self, &b);
@@ -386,4 +386,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
 #ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
     #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
 #endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
-/*[clinic end generated code: output=57bf2c09a42bd330 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f5b8860a658a001a input=a9049054013a1b77]*/
diff --git a/Modules/_multiprocessing/clinic/posixshmem.c.h b/Modules/_multiprocessing/clinic/posixshmem.c.h
index 0ebfa2fe3789..a99f0d2aae1d 100644
--- a/Modules/_multiprocessing/clinic/posixshmem.c.h
+++ b/Modules/_multiprocessing/clinic/posixshmem.c.h
@@ -35,7 +35,7 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("shm_open", 1, "str", args[0]);
+        _PyArg_BadArgument("shm_open", "argument 'path'", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -108,7 +108,7 @@ _posixshmem_shm_unlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("shm_unlink", 1, "str", args[0]);
+        _PyArg_BadArgument("shm_unlink", "argument 'path'", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -130,4 +130,4 @@ _posixshmem_shm_unlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs
 #ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
     #define _POSIXSHMEM_SHM_UNLINK_METHODDEF
 #endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */
-/*[clinic end generated code: output=be42e23c18677c0f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9132861c61d8c2d8 input=a9049054013a1b77]*/
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 84774f007600..5ddbbe221b98 100644
--- a/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -55,7 +55,7 @@ _multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject *cons
         }
     }
     else {
-        _PyArg_BadArgument("encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("encode", "argument 'errors'", "str or None", args[1]);
         goto exit;
     }
 skip_optional_pos:
@@ -103,7 +103,7 @@ _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *cons
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&input, 'C')) {
-        _PyArg_BadArgument("decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("decode", "argument 'input'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -124,7 +124,7 @@ _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *cons
         }
     }
     else {
-        _PyArg_BadArgument("decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("decode", "argument 'errors'", "str or None", args[1]);
         goto exit;
     }
 skip_optional_pos:
@@ -223,7 +223,7 @@ _multibytecodec_MultibyteIncrementalEncoder_setstate(MultibyteIncrementalEncoder
     PyLongObject *statelong;
 
     if (!PyLong_Check(arg)) {
-        _PyArg_BadArgument("setstate", 0, "int", arg);
+        _PyArg_BadArgument("setstate", "argument", "int", arg);
         goto exit;
     }
     statelong = (PyLongObject *)arg;
@@ -282,7 +282,7 @@ _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderOb
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&input, 'C')) {
-        _PyArg_BadArgument("decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("decode", "argument 'input'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -345,7 +345,7 @@ _multibytecodec_MultibyteIncrementalDecoder_setstate(MultibyteIncrementalDecoder
     PyObject *state;
 
     if (!PyTuple_Check(arg)) {
-        _PyArg_BadArgument("setstate", 0, "tuple", arg);
+        _PyArg_BadArgument("setstate", "argument", "tuple", arg);
         goto exit;
     }
     state = arg;
@@ -525,4 +525,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
 
 #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF    \
     {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
-/*[clinic end generated code: output=eb95a408c4ddbfff input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5ce6fd4ca1f95620 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
index cc16d8bb228f..ac826bd9b598 100644
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -29,7 +29,7 @@ _bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("compress", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("compress", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _bz2_BZ2Compressor_compress_impl(self, &data);
@@ -156,7 +156,7 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *const *args, Py
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("decompress", "argument 'data'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -220,4 +220,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=8e123f4eec497655 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ec3d1b3652c98823 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index 65e24832fff6..be1d2f70cf1b 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -34,7 +34,7 @@ _codecs_lookup(PyObject *module, PyObject *arg)
     const char *encoding;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("lookup", 0, "str", arg);
+        _PyArg_BadArgument("lookup", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t encoding_length;
@@ -93,7 +93,7 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[1]) {
         if (!PyUnicode_Check(args[1])) {
-            _PyArg_BadArgument("encode", 2, "str", args[1]);
+            _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[1]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -110,7 +110,7 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
         }
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("encode", 3, "str", args[2]);
+        _PyArg_BadArgument("encode", "argument 'errors'", "str", args[2]);
         goto exit;
     }
     Py_ssize_t errors_length;
@@ -170,7 +170,7 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[1]) {
         if (!PyUnicode_Check(args[1])) {
-            _PyArg_BadArgument("decode", 2, "str", args[1]);
+            _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[1]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -187,7 +187,7 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
         }
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("decode", 3, "str", args[2]);
+        _PyArg_BadArgument("decode", "argument 'errors'", "str", args[2]);
         goto exit;
     }
     Py_ssize_t errors_length;
@@ -225,7 +225,7 @@ _codecs__forget_codec(PyObject *module, PyObject *arg)
     const char *encoding;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("_forget_codec", 0, "str", arg);
+        _PyArg_BadArgument("_forget_codec", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t encoding_length;
@@ -278,7 +278,7 @@ _codecs_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&data, 'C')) {
-            _PyArg_BadArgument("escape_decode", 1, "contiguous buffer", args[0]);
+            _PyArg_BadArgument("escape_decode", "argument 1", "contiguous buffer", args[0]);
             goto exit;
         }
     }
@@ -300,7 +300,7 @@ _codecs_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("escape_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("escape_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -338,7 +338,7 @@ _codecs_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBytes_Check(args[0])) {
-        _PyArg_BadArgument("escape_encode", 1, "bytes", args[0]);
+        _PyArg_BadArgument("escape_encode", "argument 1", "bytes", args[0]);
         goto exit;
     }
     data = args[0];
@@ -360,7 +360,7 @@ _codecs_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("escape_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("escape_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -397,7 +397,7 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_7_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_7_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -418,7 +418,7 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_7_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_7_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -472,7 +472,7 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_8_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_8_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -493,7 +493,7 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_8_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_8_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -547,7 +547,7 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_16_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_16_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -568,7 +568,7 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -622,7 +622,7 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_16_le_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_16_le_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -643,7 +643,7 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_le_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_le_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -697,7 +697,7 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_16_be_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_16_be_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -718,7 +718,7 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_be_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_be_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -774,7 +774,7 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_16_ex_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_16_ex_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -795,7 +795,7 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_ex_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_ex_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -861,7 +861,7 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_32_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_32_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -882,7 +882,7 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -936,7 +936,7 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_32_le_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_32_le_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -957,7 +957,7 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_le_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_le_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1011,7 +1011,7 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_32_be_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_32_be_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1032,7 +1032,7 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_be_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_be_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1088,7 +1088,7 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("utf_32_ex_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("utf_32_ex_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1109,7 +1109,7 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_ex_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_ex_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1183,7 +1183,7 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&data, 'C')) {
-            _PyArg_BadArgument("unicode_escape_decode", 1, "contiguous buffer", args[0]);
+            _PyArg_BadArgument("unicode_escape_decode", "argument 1", "contiguous buffer", args[0]);
             goto exit;
         }
     }
@@ -1205,7 +1205,7 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_
         }
     }
     else {
-        _PyArg_BadArgument("unicode_escape_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("unicode_escape_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1255,7 +1255,7 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ss
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&data, 'C')) {
-            _PyArg_BadArgument("raw_unicode_escape_decode", 1, "contiguous buffer", args[0]);
+            _PyArg_BadArgument("raw_unicode_escape_decode", "argument 1", "contiguous buffer", args[0]);
             goto exit;
         }
     }
@@ -1277,7 +1277,7 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ss
         }
     }
     else {
-        _PyArg_BadArgument("raw_unicode_escape_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("raw_unicode_escape_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1318,7 +1318,7 @@ _codecs_latin_1_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("latin_1_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("latin_1_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1339,7 +1339,7 @@ _codecs_latin_1_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         }
     }
     else {
-        _PyArg_BadArgument("latin_1_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("latin_1_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1380,7 +1380,7 @@ _codecs_ascii_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("ascii_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("ascii_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1401,7 +1401,7 @@ _codecs_ascii_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("ascii_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("ascii_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1443,7 +1443,7 @@ _codecs_charmap_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("charmap_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("charmap_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1464,7 +1464,7 @@ _codecs_charmap_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         }
     }
     else {
-        _PyArg_BadArgument("charmap_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("charmap_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1512,7 +1512,7 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("mbcs_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("mbcs_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1533,7 +1533,7 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("mbcs_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("mbcs_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1591,7 +1591,7 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("oem_decode", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("oem_decode", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -1612,7 +1612,7 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("oem_decode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("oem_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1680,7 +1680,7 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("code_page_decode", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("code_page_decode", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -1701,7 +1701,7 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("code_page_decode", 3, "str or None", args[2]);
+        _PyArg_BadArgument("code_page_decode", "argument 3", "str or None", args[2]);
         goto exit;
     }
     if (nargs < 4) {
@@ -1765,7 +1765,7 @@ _codecs_readbuffer_encode(PyObject *module, PyObject *const *args, Py_ssize_t na
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&data, 'C')) {
-            _PyArg_BadArgument("readbuffer_encode", 1, "contiguous buffer", args[0]);
+            _PyArg_BadArgument("readbuffer_encode", "argument 1", "contiguous buffer", args[0]);
             goto exit;
         }
     }
@@ -1787,7 +1787,7 @@ _codecs_readbuffer_encode(PyObject *module, PyObject *const *args, Py_ssize_t na
         }
     }
     else {
-        _PyArg_BadArgument("readbuffer_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("readbuffer_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1825,7 +1825,7 @@ _codecs_utf_7_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_7_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_7_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -1850,7 +1850,7 @@ _codecs_utf_7_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_7_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_7_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1883,7 +1883,7 @@ _codecs_utf_8_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_8_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_8_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -1908,7 +1908,7 @@ _codecs_utf_8_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_8_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_8_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -1942,7 +1942,7 @@ _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_16_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_16_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -1967,7 +1967,7 @@ _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -2012,7 +2012,7 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_16_le_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_16_le_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2037,7 +2037,7 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_le_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_le_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2070,7 +2070,7 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_16_be_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_16_be_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2095,7 +2095,7 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_16_be_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_16_be_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2129,7 +2129,7 @@ _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_32_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_32_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2154,7 +2154,7 @@ _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -2199,7 +2199,7 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_32_le_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_32_le_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2224,7 +2224,7 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_le_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_le_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2257,7 +2257,7 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("utf_32_be_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("utf_32_be_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2282,7 +2282,7 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("utf_32_be_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("utf_32_be_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2315,7 +2315,7 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("unicode_escape_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("unicode_escape_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2340,7 +2340,7 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_
         }
     }
     else {
-        _PyArg_BadArgument("unicode_escape_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("unicode_escape_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2373,7 +2373,7 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ss
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("raw_unicode_escape_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("raw_unicode_escape_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2398,7 +2398,7 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ss
         }
     }
     else {
-        _PyArg_BadArgument("raw_unicode_escape_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("raw_unicode_escape_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2431,7 +2431,7 @@ _codecs_latin_1_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("latin_1_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("latin_1_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2456,7 +2456,7 @@ _codecs_latin_1_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         }
     }
     else {
-        _PyArg_BadArgument("latin_1_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("latin_1_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2489,7 +2489,7 @@ _codecs_ascii_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("ascii_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("ascii_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2514,7 +2514,7 @@ _codecs_ascii_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("ascii_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("ascii_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2548,7 +2548,7 @@ _codecs_charmap_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("charmap_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("charmap_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2573,7 +2573,7 @@ _codecs_charmap_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         }
     }
     else {
-        _PyArg_BadArgument("charmap_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("charmap_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -2605,7 +2605,7 @@ _codecs_charmap_build(PyObject *module, PyObject *arg)
     PyObject *map;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("charmap_build", 0, "str", arg);
+        _PyArg_BadArgument("charmap_build", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -2642,7 +2642,7 @@ _codecs_mbcs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("mbcs_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("mbcs_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2667,7 +2667,7 @@ _codecs_mbcs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("mbcs_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("mbcs_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2703,7 +2703,7 @@ _codecs_oem_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("oem_encode", 1, "str", args[0]);
+        _PyArg_BadArgument("oem_encode", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -2728,7 +2728,7 @@ _codecs_oem_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("oem_encode", 2, "str or None", args[1]);
+        _PyArg_BadArgument("oem_encode", "argument 2", "str or None", args[1]);
         goto exit;
     }
 skip_optional:
@@ -2775,7 +2775,7 @@ _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("code_page_encode", 2, "str", args[1]);
+        _PyArg_BadArgument("code_page_encode", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -2800,7 +2800,7 @@ _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
         }
     }
     else {
-        _PyArg_BadArgument("code_page_encode", 3, "str or None", args[2]);
+        _PyArg_BadArgument("code_page_encode", "argument 3", "str or None", args[2]);
         goto exit;
     }
 skip_optional:
@@ -2840,7 +2840,7 @@ _codecs_register_error(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("register_error", 1, "str", args[0]);
+        _PyArg_BadArgument("register_error", "argument 1", "str", args[0]);
         goto exit;
     }
     Py_ssize_t errors_length;
@@ -2881,7 +2881,7 @@ _codecs_lookup_error(PyObject *module, PyObject *arg)
     const char *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("lookup_error", 0, "str", arg);
+        _PyArg_BadArgument("lookup_error", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t name_length;
@@ -2922,4 +2922,4 @@ _codecs_lookup_error(PyObject *module, PyObject *arg)
 #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
     #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
 #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
-/*[clinic end generated code: output=da3c47709a55a05e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=59726a305e4ec24a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h
index 2fcb0c1bf12c..ea91d7c130b8 100644
--- a/Modules/clinic/_cryptmodule.c.h
+++ b/Modules/clinic/_cryptmodule.c.h
@@ -30,7 +30,7 @@ crypt_crypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("crypt", 1, "str", args[0]);
+        _PyArg_BadArgument("crypt", "argument 1", "str", args[0]);
         goto exit;
     }
     Py_ssize_t word_length;
@@ -43,7 +43,7 @@ crypt_crypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("crypt", 2, "str", args[1]);
+        _PyArg_BadArgument("crypt", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t salt_length;
@@ -60,4 +60,4 @@ crypt_crypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=3f75d4d4be4dddbb input=a9049054013a1b77]*/
+/*[clinic end generated code: output=549de0d43b030126 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_curses_panel.c.h b/Modules/clinic/_curses_panel.c.h
index 0df442056ea9..9840ed86e791 100644
--- a/Modules/clinic/_curses_panel.c.h
+++ b/Modules/clinic/_curses_panel.c.h
@@ -214,7 +214,7 @@ _curses_panel_panel_replace(PyCursesPanelObject *self, PyObject *arg)
     PyCursesWindowObject *win;
 
     if (!PyObject_TypeCheck(arg, &PyCursesWindow_Type)) {
-        _PyArg_BadArgument("replace", 0, (&PyCursesWindow_Type)->tp_name, arg);
+        _PyArg_BadArgument("replace", "argument", (&PyCursesWindow_Type)->tp_name, arg);
         goto exit;
     }
     win = (PyCursesWindowObject *)arg;
@@ -288,7 +288,7 @@ _curses_panel_new_panel(PyObject *module, PyObject *arg)
     PyCursesWindowObject *win;
 
     if (!PyObject_TypeCheck(arg, &PyCursesWindow_Type)) {
-        _PyArg_BadArgument("new_panel", 0, (&PyCursesWindow_Type)->tp_name, arg);
+        _PyArg_BadArgument("new_panel", "argument", (&PyCursesWindow_Type)->tp_name, arg);
         goto exit;
     }
     win = (PyCursesWindowObject *)arg;
@@ -335,4 +335,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
     return _curses_panel_update_panels_impl(module);
 }
-/*[clinic end generated code: output=3cc16062281b7e07 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d96dc1fd68e898d9 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 6837eac39096..ad93e6a0ca02 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -2521,7 +2521,7 @@ _curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyLong_Check(args[4])) {
-        _PyArg_BadArgument("ungetmouse", 5, "int", args[4]);
+        _PyArg_BadArgument("ungetmouse", "argument 5", "int", args[4]);
         goto exit;
     }
     bstate = PyLong_AsUnsignedLongMask(args[4]);
@@ -3017,7 +3017,7 @@ _curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
             }
         }
         else {
-            _PyArg_BadArgument("setupterm", 1, "str or None", args[0]);
+            _PyArg_BadArgument("setupterm", "argument 'term'", "str or None", args[0]);
             goto exit;
         }
         if (!--noptargs) {
@@ -3326,7 +3326,7 @@ _curses_mousemask(PyObject *module, PyObject *arg)
     unsigned long newmask;
 
     if (!PyLong_Check(arg)) {
-        _PyArg_BadArgument("mousemask", 0, "int", arg);
+        _PyArg_BadArgument("mousemask", "argument", "int", arg);
         goto exit;
     }
     newmask = PyLong_AsUnsignedLongMask(arg);
@@ -4201,7 +4201,7 @@ _curses_tigetflag(PyObject *module, PyObject *arg)
     const char *capname;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("tigetflag", 0, "str", arg);
+        _PyArg_BadArgument("tigetflag", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t capname_length;
@@ -4244,7 +4244,7 @@ _curses_tigetnum(PyObject *module, PyObject *arg)
     const char *capname;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("tigetnum", 0, "str", arg);
+        _PyArg_BadArgument("tigetnum", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t capname_length;
@@ -4287,7 +4287,7 @@ _curses_tigetstr(PyObject *module, PyObject *arg)
     const char *capname;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("tigetstr", 0, "str", arg);
+        _PyArg_BadArgument("tigetstr", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t capname_length;
@@ -4569,4 +4569,4 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
 #ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
     #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
 #endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
-/*[clinic end generated code: output=1350eeb0c1e06af6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e5b3502f1d38dff0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
index e54c69cf7082..a7d735085068 100644
--- a/Modules/clinic/_dbmmodule.c.h
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -136,7 +136,7 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("open", 1, "str", args[0]);
+        _PyArg_BadArgument("open", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -147,7 +147,7 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("open", 2, "str", args[1]);
+        _PyArg_BadArgument("open", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t flags_length;
@@ -177,4 +177,4 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=7f5d30ef5d820b8a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7ced103488cbca7a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index 0f55480140b3..324e549d486a 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -20,7 +20,7 @@ _elementtree_Element_append(ElementObject *self, PyObject *arg)
     PyObject *subelement;
 
     if (!PyObject_TypeCheck(arg, &Element_Type)) {
-        _PyArg_BadArgument("append", 0, (&Element_Type)->tp_name, arg);
+        _PyArg_BadArgument("append", "argument", (&Element_Type)->tp_name, arg);
         goto exit;
     }
     subelement = arg;
@@ -82,7 +82,7 @@ _elementtree_Element___deepcopy__(ElementObject *self, PyObject *arg)
     PyObject *memo;
 
     if (!PyDict_Check(arg)) {
-        _PyArg_BadArgument("__deepcopy__", 0, "dict", arg);
+        _PyArg_BadArgument("__deepcopy__", "argument", "dict", arg);
         goto exit;
     }
     memo = arg;
@@ -501,7 +501,7 @@ _elementtree_Element_insert(ElementObject *self, PyObject *const *args, Py_ssize
         index = ival;
     }
     if (!PyObject_TypeCheck(args[1], &Element_Type)) {
-        _PyArg_BadArgument("insert", 2, (&Element_Type)->tp_name, args[1]);
+        _PyArg_BadArgument("insert", "argument 2", (&Element_Type)->tp_name, args[1]);
         goto exit;
     }
     subelement = args[1];
@@ -593,7 +593,7 @@ _elementtree_Element_remove(ElementObject *self, PyObject *arg)
     PyObject *subelement;
 
     if (!PyObject_TypeCheck(arg, &Element_Type)) {
-        _PyArg_BadArgument("remove", 0, (&Element_Type)->tp_name, arg);
+        _PyArg_BadArgument("remove", "argument", (&Element_Type)->tp_name, arg);
         goto exit;
     }
     subelement = arg;
@@ -892,7 +892,7 @@ _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs
         }
     }
     else {
-        _PyArg_BadArgument("XMLParser", 2, "str or None", fastargs[1]);
+        _PyArg_BadArgument("XMLParser", "argument 'encoding'", "str or None", fastargs[1]);
         goto exit;
     }
 skip_optional_kwonly:
@@ -969,4 +969,4 @@ _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *const *args,
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=386a68425d072b5c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=50e0b1954c5f9e0f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
index 15f47dc70dc6..aa37a24d3b21 100644
--- a/Modules/clinic/_gdbmmodule.c.h
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -257,7 +257,7 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("open", 1, "str", args[0]);
+        _PyArg_BadArgument("open", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -268,7 +268,7 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("open", 2, "str", args[1]);
+        _PyArg_BadArgument("open", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t flags_length;
@@ -298,4 +298,4 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=0a72598e5a3acd60 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2766471b2fa1a816 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h
index 5596f13e508f..6377e18ece7a 100644
--- a/Modules/clinic/_hashopenssl.c.h
+++ b/Modules/clinic/_hashopenssl.c.h
@@ -145,7 +145,7 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("pbkdf2_hmac", 1, "str", args[0]);
+        _PyArg_BadArgument("pbkdf2_hmac", "argument 'hash_name'", "str", args[0]);
         goto exit;
     }
     Py_ssize_t hash_name_length;
@@ -161,14 +161,14 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&password, 'C')) {
-        _PyArg_BadArgument("pbkdf2_hmac", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("pbkdf2_hmac", "argument 'password'", "contiguous buffer", args[1]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[2], &salt, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&salt, 'C')) {
-        _PyArg_BadArgument("pbkdf2_hmac", 3, "contiguous buffer", args[2]);
+        _PyArg_BadArgument("pbkdf2_hmac", "argument 'salt'", "contiguous buffer", args[2]);
         goto exit;
     }
     if (PyFloat_Check(args[3])) {
@@ -243,7 +243,7 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&password, 'C')) {
-        _PyArg_BadArgument("scrypt", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("scrypt", "argument 'password'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -254,7 +254,7 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&salt, 'C')) {
-            _PyArg_BadArgument("scrypt", 2, "contiguous buffer", args[1]);
+            _PyArg_BadArgument("scrypt", "argument 'salt'", "contiguous buffer", args[1]);
             goto exit;
         }
         if (!--noptargs) {
@@ -263,7 +263,7 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
     }
     if (args[2]) {
         if (!PyLong_Check(args[2])) {
-            _PyArg_BadArgument("scrypt", 3, "int", args[2]);
+            _PyArg_BadArgument("scrypt", "argument 'n'", "int", args[2]);
             goto exit;
         }
         n_obj = args[2];
@@ -273,7 +273,7 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
     }
     if (args[3]) {
         if (!PyLong_Check(args[3])) {
-            _PyArg_BadArgument("scrypt", 4, "int", args[3]);
+            _PyArg_BadArgument("scrypt", "argument 'r'", "int", args[3]);
             goto exit;
         }
         r_obj = args[3];
@@ -283,7 +283,7 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
     }
     if (args[4]) {
         if (!PyLong_Check(args[4])) {
-            _PyArg_BadArgument("scrypt", 5, "int", args[4]);
+            _PyArg_BadArgument("scrypt", "argument 'p'", "int", args[4]);
             goto exit;
         }
         p_obj = args[4];
@@ -364,18 +364,18 @@ _hashlib_hmac_digest(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&key, 'C')) {
-        _PyArg_BadArgument("hmac_digest", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("hmac_digest", "argument 'key'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &msg, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&msg, 'C')) {
-        _PyArg_BadArgument("hmac_digest", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("hmac_digest", "argument 'msg'", "contiguous buffer", args[1]);
         goto exit;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("hmac_digest", 3, "str", args[2]);
+        _PyArg_BadArgument("hmac_digest", "argument 'digest'", "str", args[2]);
         goto exit;
     }
     Py_ssize_t digest_length;
@@ -409,4 +409,4 @@ _hashlib_hmac_digest(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
 #ifndef _HASHLIB_SCRYPT_METHODDEF
     #define _HASHLIB_SCRYPT_METHODDEF
 #endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
-/*[clinic end generated code: output=5955ec791260045a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=565dcbe3452e71f4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
index 68aa770d41f8..82ef4d517d83 100644
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -29,7 +29,7 @@ _lzma_LZMACompressor_compress(Compressor *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("compress", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("compress", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _lzma_LZMACompressor_compress_impl(self, &data);
@@ -110,7 +110,7 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *const *args, Py_
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("decompress", "argument 'data'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -321,7 +321,7 @@ _lzma__decode_filter_properties(PyObject *module, PyObject *const *args, Py_ssiz
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&encoded_props, 'C')) {
-        _PyArg_BadArgument("_decode_filter_properties", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("_decode_filter_properties", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props);
@@ -334,4 +334,4 @@ _lzma__decode_filter_properties(PyObject *module, PyObject *const *args, Py_ssiz
 
     return return_value;
 }
-/*[clinic end generated code: output=1a290aa478603107 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f7477a10e86a717d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h
index 8ac723fd43a6..b92daa72105a 100644
--- a/Modules/clinic/_pickle.c.h
+++ b/Modules/clinic/_pickle.c.h
@@ -356,7 +356,7 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
     }
     if (fastargs[2]) {
         if (!PyUnicode_Check(fastargs[2])) {
-            _PyArg_BadArgument("Unpickler", 3, "str", fastargs[2]);
+            _PyArg_BadArgument("Unpickler", "argument 'encoding'", "str", fastargs[2]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -374,7 +374,7 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
     }
     if (fastargs[3]) {
         if (!PyUnicode_Check(fastargs[3])) {
-            _PyArg_BadArgument("Unpickler", 4, "str", fastargs[3]);
+            _PyArg_BadArgument("Unpickler", "argument 'errors'", "str", fastargs[3]);
             goto exit;
         }
         Py_ssize_t errors_length;
@@ -691,7 +691,7 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
     }
     if (args[2]) {
         if (!PyUnicode_Check(args[2])) {
-            _PyArg_BadArgument("load", 3, "str", args[2]);
+            _PyArg_BadArgument("load", "argument 'encoding'", "str", args[2]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -709,7 +709,7 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
     }
     if (args[3]) {
         if (!PyUnicode_Check(args[3])) {
-            _PyArg_BadArgument("load", 4, "str", args[3]);
+            _PyArg_BadArgument("load", "argument 'errors'", "str", args[3]);
             goto exit;
         }
         Py_ssize_t errors_length;
@@ -794,7 +794,7 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
     }
     if (args[2]) {
         if (!PyUnicode_Check(args[2])) {
-            _PyArg_BadArgument("loads", 3, "str", args[2]);
+            _PyArg_BadArgument("loads", "argument 'encoding'", "str", args[2]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -812,7 +812,7 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
     }
     if (args[3]) {
         if (!PyUnicode_Check(args[3])) {
-            _PyArg_BadArgument("loads", 4, "str", args[3]);
+            _PyArg_BadArgument("loads", "argument 'errors'", "str", args[3]);
             goto exit;
         }
         Py_ssize_t errors_length;
@@ -835,4 +835,4 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=8dc0e862f96c4afe input=a9049054013a1b77]*/
+/*[clinic end generated code: output=17f6a76ebd94325d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index 9c08dec4541a..d398a8504ba4 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -894,7 +894,7 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyList_Check(args[2])) {
-        _PyArg_BadArgument("compile", 3, "list", args[2]);
+        _PyArg_BadArgument("compile", "argument 'code'", "list", args[2]);
         goto exit;
     }
     code = args[2];
@@ -916,12 +916,12 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         groups = ival;
     }
     if (!PyDict_Check(args[4])) {
-        _PyArg_BadArgument("compile", 5, "dict", args[4]);
+        _PyArg_BadArgument("compile", "argument 'groupindex'", "dict", args[4]);
         goto exit;
     }
     groupindex = args[4];
     if (!PyTuple_Check(args[5])) {
-        _PyArg_BadArgument("compile", 6, "tuple", args[5]);
+        _PyArg_BadArgument("compile", "argument 'indexgroup'", "tuple", args[5]);
         goto exit;
     }
     indexgroup = args[5];
@@ -1207,4 +1207,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
 {
     return _sre_SRE_Scanner_search_impl(self);
 }
-/*[clinic end generated code: output=67b702da5bdc9cac input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1adeddce58ae284c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index adef7dbf90ce..25769a225af9 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -222,7 +222,7 @@ _ssl__SSLSocket_write(PySSLSocket *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&b, 'C')) {
-        _PyArg_BadArgument("write", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _ssl__SSLSocket_write_impl(self, &b);
@@ -353,7 +353,7 @@ _ssl__SSLSocket_get_channel_binding(PySSLSocket *self, PyObject *const *args, Py
         goto skip_optional_pos;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("get_channel_binding", 1, "str", args[0]);
+        _PyArg_BadArgument("get_channel_binding", "argument 'cb_type'", "str", args[0]);
         goto exit;
     }
     Py_ssize_t cb_type_length;
@@ -439,7 +439,7 @@ _ssl__SSLContext_set_ciphers(PySSLContext *self, PyObject *arg)
     const char *cipherlist;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("set_ciphers", 0, "str", arg);
+        _PyArg_BadArgument("set_ciphers", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t cipherlist_length;
@@ -500,7 +500,7 @@ _ssl__SSLContext__set_npn_protocols(PySSLContext *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&protos, 'C')) {
-        _PyArg_BadArgument("_set_npn_protocols", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("_set_npn_protocols", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _ssl__SSLContext__set_npn_protocols_impl(self, &protos);
@@ -536,7 +536,7 @@ _ssl__SSLContext__set_alpn_protocols(PySSLContext *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&protos, 'C')) {
-        _PyArg_BadArgument("_set_alpn_protocols", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("_set_alpn_protocols", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _ssl__SSLContext__set_alpn_protocols_impl(self, &protos);
@@ -690,7 +690,7 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
         goto exit;
     }
     if (!PyObject_TypeCheck(args[0], PySocketModule.Sock_Type)) {
-        _PyArg_BadArgument("_wrap_socket", 1, (PySocketModule.Sock_Type)->tp_name, args[0]);
+        _PyArg_BadArgument("_wrap_socket", "argument 'sock'", (PySocketModule.Sock_Type)->tp_name, args[0]);
         goto exit;
     }
     sock = args[0];
@@ -765,12 +765,12 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
         goto exit;
     }
     if (!PyObject_TypeCheck(args[0], &PySSLMemoryBIO_Type)) {
-        _PyArg_BadArgument("_wrap_bio", 1, (&PySSLMemoryBIO_Type)->tp_name, args[0]);
+        _PyArg_BadArgument("_wrap_bio", "argument 'incoming'", (&PySSLMemoryBIO_Type)->tp_name, args[0]);
         goto exit;
     }
     incoming = (PySSLMemoryBIO *)args[0];
     if (!PyObject_TypeCheck(args[1], &PySSLMemoryBIO_Type)) {
-        _PyArg_BadArgument("_wrap_bio", 2, (&PySSLMemoryBIO_Type)->tp_name, args[1]);
+        _PyArg_BadArgument("_wrap_bio", "argument 'outgoing'", (&PySSLMemoryBIO_Type)->tp_name, args[1]);
         goto exit;
     }
     outgoing = (PySSLMemoryBIO *)args[1];
@@ -1017,7 +1017,7 @@ _ssl_MemoryBIO_write(PySSLMemoryBIO *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&b, 'C')) {
-        _PyArg_BadArgument("write", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = _ssl_MemoryBIO_write_impl(self, &b);
@@ -1089,7 +1089,7 @@ _ssl_RAND_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&view, 'C')) {
-            _PyArg_BadArgument("RAND_add", 1, "contiguous buffer", args[0]);
+            _PyArg_BadArgument("RAND_add", "argument 1", "contiguous buffer", args[0]);
             goto exit;
         }
     }
@@ -1289,7 +1289,7 @@ _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("txt2obj", 1, "str", args[0]);
+        _PyArg_BadArgument("txt2obj", "argument 'txt'", "str", args[0]);
         goto exit;
     }
     Py_ssize_t txt_length;
@@ -1382,7 +1382,7 @@ _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("enum_certificates", 1, "str", args[0]);
+        _PyArg_BadArgument("enum_certificates", "argument 'store_name'", "str", args[0]);
         goto exit;
     }
     Py_ssize_t store_name_length;
@@ -1435,7 +1435,7 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("enum_crls", 1, "str", args[0]);
+        _PyArg_BadArgument("enum_crls", "argument 'store_name'", "str", args[0]);
         goto exit;
     }
     Py_ssize_t store_name_length;
@@ -1482,4 +1482,4 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
 #ifndef _SSL_ENUM_CRLS_METHODDEF
     #define _SSL_ENUM_CRLS_METHODDEF
 #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=5003112e167cd948 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=aa4947067c3fef2d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h
index 908c44266c4e..36c4b4046cd7 100644
--- a/Modules/clinic/_struct.c.h
+++ b/Modules/clinic/_struct.c.h
@@ -65,7 +65,7 @@ Struct_unpack(PyStructObject *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("unpack", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("unpack", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = Struct_unpack_impl(self, &buffer);
@@ -118,7 +118,7 @@ Struct_unpack_from(PyStructObject *self, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("unpack_from", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("unpack_from", "argument 'buffer'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -253,7 +253,7 @@ unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("unpack", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("unpack", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = unpack_impl(module, s_object, &buffer);
@@ -309,7 +309,7 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("unpack_from", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("unpack_from", "argument 'buffer'", "contiguous buffer", args[1]);
         goto exit;
     }
     if (!noptargs) {
@@ -386,4 +386,4 @@ iter_unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 
     return return_value;
 }
-/*[clinic end generated code: output=b642e1002d25ebdd input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6a6228cfc4b7099c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h
index 0a3e7ff5fc96..4870e9b4aad7 100644
--- a/Modules/clinic/_tkinter.c.h
+++ b/Modules/clinic/_tkinter.c.h
@@ -20,7 +20,7 @@ _tkinter_tkapp_eval(TkappObject *self, PyObject *arg)
     const char *script;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("eval", 0, "str", arg);
+        _PyArg_BadArgument("eval", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t script_length;
@@ -56,7 +56,7 @@ _tkinter_tkapp_evalfile(TkappObject *self, PyObject *arg)
     const char *fileName;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("evalfile", 0, "str", arg);
+        _PyArg_BadArgument("evalfile", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t fileName_length;
@@ -92,7 +92,7 @@ _tkinter_tkapp_record(TkappObject *self, PyObject *arg)
     const char *script;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("record", 0, "str", arg);
+        _PyArg_BadArgument("record", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t script_length;
@@ -128,7 +128,7 @@ _tkinter_tkapp_adderrorinfo(TkappObject *self, PyObject *arg)
     const char *msg;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("adderrorinfo", 0, "str", arg);
+        _PyArg_BadArgument("adderrorinfo", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t msg_length;
@@ -188,7 +188,7 @@ _tkinter_tkapp_exprstring(TkappObject *self, PyObject *arg)
     const char *s;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("exprstring", 0, "str", arg);
+        _PyArg_BadArgument("exprstring", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t s_length;
@@ -224,7 +224,7 @@ _tkinter_tkapp_exprlong(TkappObject *self, PyObject *arg)
     const char *s;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("exprlong", 0, "str", arg);
+        _PyArg_BadArgument("exprlong", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t s_length;
@@ -260,7 +260,7 @@ _tkinter_tkapp_exprdouble(TkappObject *self, PyObject *arg)
     const char *s;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("exprdouble", 0, "str", arg);
+        _PyArg_BadArgument("exprdouble", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t s_length;
@@ -296,7 +296,7 @@ _tkinter_tkapp_exprboolean(TkappObject *self, PyObject *arg)
     const char *s;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("exprboolean", 0, "str", arg);
+        _PyArg_BadArgument("exprboolean", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t s_length;
@@ -353,7 +353,7 @@ _tkinter_tkapp_createcommand(TkappObject *self, PyObject *const *args, Py_ssize_
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("createcommand", 1, "str", args[0]);
+        _PyArg_BadArgument("createcommand", "argument 1", "str", args[0]);
         goto exit;
     }
     Py_ssize_t name_length;
@@ -390,7 +390,7 @@ _tkinter_tkapp_deletecommand(TkappObject *self, PyObject *arg)
     const char *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("deletecommand", 0, "str", arg);
+        _PyArg_BadArgument("deletecommand", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t name_length;
@@ -731,14 +731,14 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("create", 1, "str or None", args[0]);
+        _PyArg_BadArgument("create", "argument 1", "str or None", args[0]);
         goto exit;
     }
     if (nargs < 2) {
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("create", 2, "str", args[1]);
+        _PyArg_BadArgument("create", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t baseName_length;
@@ -754,7 +754,7 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("create", 3, "str", args[2]);
+        _PyArg_BadArgument("create", "argument 3", "str", args[2]);
         goto exit;
     }
     Py_ssize_t className_length;
@@ -832,7 +832,7 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         }
     }
     else {
-        _PyArg_BadArgument("create", 8, "str or None", args[7]);
+        _PyArg_BadArgument("create", "argument 8", "str or None", args[7]);
         goto exit;
     }
 skip_optional:
@@ -912,4 +912,4 @@ _tkinter_getbusywaitinterval(PyObject *module, PyObject *Py_UNUSED(ignored))
 #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
     #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
 #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
-/*[clinic end generated code: output=2cf95f0101f3dbca input=a9049054013a1b77]*/
+/*[clinic end generated code: output=da0115c470aac1c0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h
index aa0d77f7180e..c3a908fa6a13 100644
--- a/Modules/clinic/_weakref.c.h
+++ b/Modules/clinic/_weakref.c.h
@@ -54,7 +54,7 @@ _weakref__remove_dead_weakref(PyObject *module, PyObject *const *args, Py_ssize_
         goto exit;
     }
     if (!PyDict_Check(args[0])) {
-        _PyArg_BadArgument("_remove_dead_weakref", 1, "dict", args[0]);
+        _PyArg_BadArgument("_remove_dead_weakref", "argument 1", "dict", args[0]);
         goto exit;
     }
     dct = args[0];
@@ -64,4 +64,4 @@ _weakref__remove_dead_weakref(PyObject *module, PyObject *const *args, Py_ssize_
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=eae22e2d2e43120e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c543dc2cd6ece975 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
index 5f45b7cf6734..33f82d4da8b6 100644
--- a/Modules/clinic/arraymodule.c.h
+++ b/Modules/clinic/arraymodule.c.h
@@ -345,7 +345,7 @@ array_array_fromstring(arrayobject *self, PyObject *arg)
             goto exit;
         }
         if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-            _PyArg_BadArgument("fromstring", 0, "contiguous buffer", arg);
+            _PyArg_BadArgument("fromstring", "argument", "contiguous buffer", arg);
             goto exit;
         }
     }
@@ -382,7 +382,7 @@ array_array_frombytes(arrayobject *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("frombytes", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("frombytes", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = array_array_frombytes_impl(self, &buffer);
@@ -537,14 +537,14 @@ array__array_reconstructor(PyObject *module, PyObject *const *args, Py_ssize_t n
     }
     arraytype = (PyTypeObject *)args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("_array_reconstructor", 2, "a unicode character", args[1]);
+        _PyArg_BadArgument("_array_reconstructor", "argument 2", "a unicode character", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1])) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(args[1]) != 1) {
-        _PyArg_BadArgument("_array_reconstructor", 2, "a unicode character", args[1]);
+        _PyArg_BadArgument("_array_reconstructor", "argument 2", "a unicode character", args[1]);
         goto exit;
     }
     typecode = PyUnicode_READ_CHAR(args[1], 0);
@@ -599,4 +599,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
 
 #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF    \
     {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=c9a40f11f1a866fb input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6aa421571e2c0756 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h
index aa176964b0f3..8745533eeb62 100644
--- a/Modules/clinic/audioop.c.h
+++ b/Modules/clinic/audioop.c.h
@@ -30,7 +30,7 @@ audioop_getsample(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("getsample", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("getsample", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -96,7 +96,7 @@ audioop_max(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("max", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("max", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -145,7 +145,7 @@ audioop_minmax(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("minmax", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("minmax", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -194,7 +194,7 @@ audioop_avg(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("avg", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("avg", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -243,7 +243,7 @@ audioop_rms(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("rms", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("rms", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -293,14 +293,14 @@ audioop_findfit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("findfit", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("findfit", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &reference, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&reference, 'C')) {
-        _PyArg_BadArgument("findfit", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("findfit", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = audioop_findfit_impl(module, &fragment, &reference);
@@ -345,14 +345,14 @@ audioop_findfactor(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("findfactor", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("findfactor", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &reference, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&reference, 'C')) {
-        _PyArg_BadArgument("findfactor", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("findfactor", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = audioop_findfactor_impl(module, &fragment, &reference);
@@ -397,7 +397,7 @@ audioop_findmax(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("findmax", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("findmax", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -454,7 +454,7 @@ audioop_avgpp(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("avgpp", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("avgpp", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -503,7 +503,7 @@ audioop_maxpp(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("maxpp", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("maxpp", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -552,7 +552,7 @@ audioop_cross(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("cross", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("cross", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -603,7 +603,7 @@ audioop_mul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("mul", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("mul", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -665,7 +665,7 @@ audioop_tomono(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("tomono", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("tomono", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -737,7 +737,7 @@ audioop_tostereo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("tostereo", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("tostereo", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -808,14 +808,14 @@ audioop_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment1, 'C')) {
-        _PyArg_BadArgument("add", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("add", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &fragment2, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment2, 'C')) {
-        _PyArg_BadArgument("add", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("add", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     if (PyFloat_Check(args[2])) {
@@ -869,7 +869,7 @@ audioop_bias(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("bias", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("bias", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -927,7 +927,7 @@ audioop_reverse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("reverse", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("reverse", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -976,7 +976,7 @@ audioop_byteswap(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("byteswap", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("byteswap", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1027,7 +1027,7 @@ audioop_lin2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("lin2lin", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("lin2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1094,7 +1094,7 @@ audioop_ratecv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("ratecv", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("ratecv", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1196,7 +1196,7 @@ audioop_lin2ulaw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("lin2ulaw", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("lin2ulaw", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1245,7 +1245,7 @@ audioop_ulaw2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("ulaw2lin", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("ulaw2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1294,7 +1294,7 @@ audioop_lin2alaw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("lin2alaw", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("lin2alaw", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1343,7 +1343,7 @@ audioop_alaw2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("alaw2lin", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("alaw2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1394,7 +1394,7 @@ audioop_lin2adpcm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("lin2adpcm", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("lin2adpcm", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1446,7 +1446,7 @@ audioop_adpcm2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&fragment, 'C')) {
-        _PyArg_BadArgument("adpcm2lin", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("adpcm2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -1469,4 +1469,4 @@ audioop_adpcm2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 
     return return_value;
 }
-/*[clinic end generated code: output=af32f4bce9c934fa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6b4f2c597f295abc input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index d48504856902..e18d407ba9e8 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -64,7 +64,7 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("b2a_uu", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("b2a_uu", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -153,7 +153,7 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("b2a_base64", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("b2a_base64", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -233,7 +233,7 @@ binascii_rlecode_hqx(PyObject *module, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("rlecode_hqx", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("rlecode_hqx", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = binascii_rlecode_hqx_impl(module, &data);
@@ -269,7 +269,7 @@ binascii_b2a_hqx(PyObject *module, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("b2a_hqx", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("b2a_hqx", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = binascii_b2a_hqx_impl(module, &data);
@@ -305,7 +305,7 @@ binascii_rledecode_hqx(PyObject *module, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("rledecode_hqx", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("rledecode_hqx", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = binascii_rledecode_hqx_impl(module, &data);
@@ -346,7 +346,7 @@ binascii_crc_hqx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("crc_hqx", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("crc_hqx", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyFloat_Check(args[1])) {
@@ -400,7 +400,7 @@ binascii_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("crc32", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("crc32", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -481,7 +481,7 @@ binascii_b2a_hex(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("b2a_hex", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("b2a_hex", "argument 'data'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -556,7 +556,7 @@ binascii_hexlify(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("hexlify", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("hexlify", "argument 'data'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -747,7 +747,7 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("b2a_qp", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("b2a_qp", "argument 'data'", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -801,4 +801,4 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
 
     return return_value;
 }
-/*[clinic end generated code: output=f7b8049edb130c63 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e13bd02ac40496f0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h
index ae99c50955f6..2e2690ad8d3f 100644
--- a/Modules/clinic/grpmodule.c.h
+++ b/Modules/clinic/grpmodule.c.h
@@ -64,7 +64,7 @@ grp_getgrnam(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("getgrnam", 1, "str", args[0]);
+        _PyArg_BadArgument("getgrnam", "argument 'name'", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -97,4 +97,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
     return grp_getgrall_impl(module);
 }
-/*[clinic end generated code: output=2aa6c60873d41ee8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9b3f26779e4e1a52 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
index b43ce64af0dc..20594b0fed4c 100644
--- a/Modules/clinic/itertoolsmodule.c.h
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -66,7 +66,7 @@ itertools__grouper(PyTypeObject *type, PyObject *args, PyObject *kwargs)
         goto exit;
     }
     if (!PyObject_TypeCheck(PyTuple_GET_ITEM(args, 0), &groupby_type)) {
-        _PyArg_BadArgument("_grouper", 1, (&groupby_type)->tp_name, PyTuple_GET_ITEM(args, 0));
+        _PyArg_BadArgument("_grouper", "argument 1", (&groupby_type)->tp_name, PyTuple_GET_ITEM(args, 0));
         goto exit;
     }
     parent = PyTuple_GET_ITEM(args, 0);
@@ -104,7 +104,7 @@ itertools_teedataobject(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     }
     it = PyTuple_GET_ITEM(args, 0);
     if (!PyList_Check(PyTuple_GET_ITEM(args, 1))) {
-        _PyArg_BadArgument("teedataobject", 2, "list", PyTuple_GET_ITEM(args, 1));
+        _PyArg_BadArgument("teedataobject", "argument 2", "list", PyTuple_GET_ITEM(args, 1));
         goto exit;
     }
     values = PyTuple_GET_ITEM(args, 1);
@@ -642,4 +642,4 @@ itertools_count(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=04c49debcae96003 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=392c9706e79f6710 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 5c674db3c3a5..1a5b03cb5be1 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -616,7 +616,7 @@ os_chflags(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
         goto exit;
     }
     if (!PyLong_Check(args[1])) {
-        _PyArg_BadArgument("chflags", 2, "int", args[1]);
+        _PyArg_BadArgument("chflags", "argument 'flags'", "int", args[1]);
         goto exit;
     }
     flags = PyLong_AsUnsignedLongMask(args[1]);
@@ -674,7 +674,7 @@ os_lchflags(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyLong_Check(args[1])) {
-        _PyArg_BadArgument("lchflags", 2, "int", args[1]);
+        _PyArg_BadArgument("lchflags", "argument 'flags'", "int", args[1]);
         goto exit;
     }
     flags = PyLong_AsUnsignedLongMask(args[1]);
@@ -4956,7 +4956,7 @@ os_write(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("write", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("write", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     _return_value = os_write_impl(module, fd, &data);
@@ -5279,7 +5279,7 @@ os_pwrite(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
-        _PyArg_BadArgument("pwrite", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("pwrite", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     if (!Py_off_t_converter(args[2], &offset)) {
@@ -6012,7 +6012,7 @@ os_putenv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("putenv", 1, "str", args[0]);
+        _PyArg_BadArgument("putenv", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -6020,7 +6020,7 @@ os_putenv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     }
     name = args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("putenv", 2, "str", args[1]);
+        _PyArg_BadArgument("putenv", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -7216,7 +7216,7 @@ os_setxattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&value, 'C')) {
-        _PyArg_BadArgument("setxattr", 3, "contiguous buffer", args[2]);
+        _PyArg_BadArgument("setxattr", "argument 'value'", "contiguous buffer", args[2]);
         goto exit;
     }
     if (!noptargs) {
@@ -8724,4 +8724,4 @@ os__remove_dll_directory(PyObject *module, PyObject *const *args, Py_ssize_t nar
 #ifndef OS__REMOVE_DLL_DIRECTORY_METHODDEF
     #define OS__REMOVE_DLL_DIRECTORY_METHODDEF
 #endif /* !defined(OS__REMOVE_DLL_DIRECTORY_METHODDEF) */
-/*[clinic end generated code: output=366a1de4c9c61a30 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ba6bac1702f55dbb input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h
index cf84ec959d58..cb83062495dc 100644
--- a/Modules/clinic/pwdmodule.c.h
+++ b/Modules/clinic/pwdmodule.c.h
@@ -34,7 +34,7 @@ pwd_getpwnam(PyObject *module, PyObject *arg)
     PyObject *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("getpwnam", 0, "str", arg);
+        _PyArg_BadArgument("getpwnam", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -74,4 +74,4 @@ pwd_getpwall(PyObject *module, PyObject *Py_UNUSED(ignored))
 #ifndef PWD_GETPWALL_METHODDEF
     #define PWD_GETPWALL_METHODDEF
 #endif /* !defined(PWD_GETPWALL_METHODDEF) */
-/*[clinic end generated code: output=f9412bdedc69706c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7fceab7f1a85da36 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
index dfb27d5f1114..41ab536bce23 100644
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -75,7 +75,7 @@ pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
     const char *base;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("SetBase", 0, "str", arg);
+        _PyArg_BadArgument("SetBase", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t base_length;
@@ -171,14 +171,14 @@ pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *con
         }
     }
     else {
-        _PyArg_BadArgument("ExternalEntityParserCreate", 1, "str or None", args[0]);
+        _PyArg_BadArgument("ExternalEntityParserCreate", "argument 1", "str or None", args[0]);
         goto exit;
     }
     if (nargs < 2) {
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("ExternalEntityParserCreate", 2, "str", args[1]);
+        _PyArg_BadArgument("ExternalEntityParserCreate", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t encoding_length;
@@ -327,7 +327,7 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
             }
         }
         else {
-            _PyArg_BadArgument("ParserCreate", 1, "str or None", args[0]);
+            _PyArg_BadArgument("ParserCreate", "argument 'encoding'", "str or None", args[0]);
             goto exit;
         }
         if (!--noptargs) {
@@ -350,7 +350,7 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
             }
         }
         else {
-            _PyArg_BadArgument("ParserCreate", 2, "str or None", args[1]);
+            _PyArg_BadArgument("ParserCreate", "argument 'namespace_separator'", "str or None", args[1]);
             goto exit;
         }
         if (!--noptargs) {
@@ -401,4 +401,4 @@ pyexpat_ErrorString(PyObject *module, PyObject *arg)
 #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
     #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
 #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
-/*[clinic end generated code: output=e48f37d326956bdd input=a9049054013a1b77]*/
+/*[clinic end generated code: output=133a4105d508ebec input=a9049054013a1b77]*/
diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h
index bc46515cb436..3cb1db14878c 100644
--- a/Modules/clinic/signalmodule.c.h
+++ b/Modules/clinic/signalmodule.c.h
@@ -590,7 +590,7 @@ signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyLong_Check(args[0])) {
-        _PyArg_BadArgument("pthread_kill", 1, "int", args[0]);
+        _PyArg_BadArgument("pthread_kill", "argument 1", "int", args[0]);
         goto exit;
     }
     thread_id = PyLong_AsUnsignedLongMask(args[0]);
@@ -658,4 +658,4 @@ signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 #ifndef SIGNAL_PTHREAD_KILL_METHODDEF
     #define SIGNAL_PTHREAD_KILL_METHODDEF
 #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
-/*[clinic end generated code: output=f0d3a5703581da76 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3320b8f73c20ba60 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/spwdmodule.c.h b/Modules/clinic/spwdmodule.c.h
index e051e6eb6589..411d2344e18f 100644
--- a/Modules/clinic/spwdmodule.c.h
+++ b/Modules/clinic/spwdmodule.c.h
@@ -25,7 +25,7 @@ spwd_getspnam(PyObject *module, PyObject *arg_)
     PyObject *arg;
 
     if (!PyUnicode_Check(arg_)) {
-        _PyArg_BadArgument("getspnam", 0, "str", arg_);
+        _PyArg_BadArgument("getspnam", "argument", "str", arg_);
         goto exit;
     }
     if (PyUnicode_READY(arg_) == -1) {
@@ -71,4 +71,4 @@ spwd_getspall(PyObject *module, PyObject *Py_UNUSED(ignored))
 #ifndef SPWD_GETSPALL_METHODDEF
     #define SPWD_GETSPALL_METHODDEF
 #endif /* !defined(SPWD_GETSPALL_METHODDEF) */
-/*[clinic end generated code: output=2bbaa6bab1d9116e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=eec8d0bedcd312e5 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/symtablemodule.c.h b/Modules/clinic/symtablemodule.c.h
index 7d8b0ad300c2..4a17f130ac97 100644
--- a/Modules/clinic/symtablemodule.c.h
+++ b/Modules/clinic/symtablemodule.c.h
@@ -31,7 +31,7 @@ _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("symtable", 3, "str", args[2]);
+        _PyArg_BadArgument("symtable", "argument 3", "str", args[2]);
         goto exit;
     }
     Py_ssize_t startstr_length;
@@ -48,4 +48,4 @@ _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=de655625eee705f4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a12f75cdbdf4e52a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h
index 8ca0881efcf8..77e4f22593b0 100644
--- a/Modules/clinic/unicodedata.c.h
+++ b/Modules/clinic/unicodedata.c.h
@@ -30,14 +30,14 @@ unicodedata_UCD_decimal(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("decimal", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("decimal", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0])) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(args[0]) != 1) {
-        _PyArg_BadArgument("decimal", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("decimal", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(args[0], 0);
@@ -79,14 +79,14 @@ unicodedata_UCD_digit(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("digit", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("digit", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0])) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(args[0]) != 1) {
-        _PyArg_BadArgument("digit", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("digit", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(args[0], 0);
@@ -129,14 +129,14 @@ unicodedata_UCD_numeric(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("numeric", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("numeric", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0])) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(args[0]) != 1) {
-        _PyArg_BadArgument("numeric", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("numeric", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(args[0], 0);
@@ -170,14 +170,14 @@ unicodedata_UCD_category(PyObject *self, PyObject *arg)
     int chr;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("category", 0, "a unicode character", arg);
+        _PyArg_BadArgument("category", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("category", 0, "a unicode character", arg);
+        _PyArg_BadArgument("category", "argument", "a unicode character", arg);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(arg, 0);
@@ -208,14 +208,14 @@ unicodedata_UCD_bidirectional(PyObject *self, PyObject *arg)
     int chr;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("bidirectional", 0, "a unicode character", arg);
+        _PyArg_BadArgument("bidirectional", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("bidirectional", 0, "a unicode character", arg);
+        _PyArg_BadArgument("bidirectional", "argument", "a unicode character", arg);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(arg, 0);
@@ -247,14 +247,14 @@ unicodedata_UCD_combining(PyObject *self, PyObject *arg)
     int _return_value;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("combining", 0, "a unicode character", arg);
+        _PyArg_BadArgument("combining", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("combining", 0, "a unicode character", arg);
+        _PyArg_BadArgument("combining", "argument", "a unicode character", arg);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(arg, 0);
@@ -291,14 +291,14 @@ unicodedata_UCD_mirrored(PyObject *self, PyObject *arg)
     int _return_value;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("mirrored", 0, "a unicode character", arg);
+        _PyArg_BadArgument("mirrored", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("mirrored", 0, "a unicode character", arg);
+        _PyArg_BadArgument("mirrored", "argument", "a unicode character", arg);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(arg, 0);
@@ -331,14 +331,14 @@ unicodedata_UCD_east_asian_width(PyObject *self, PyObject *arg)
     int chr;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("east_asian_width", 0, "a unicode character", arg);
+        _PyArg_BadArgument("east_asian_width", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("east_asian_width", 0, "a unicode character", arg);
+        _PyArg_BadArgument("east_asian_width", "argument", "a unicode character", arg);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(arg, 0);
@@ -369,14 +369,14 @@ unicodedata_UCD_decomposition(PyObject *self, PyObject *arg)
     int chr;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("decomposition", 0, "a unicode character", arg);
+        _PyArg_BadArgument("decomposition", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("decomposition", 0, "a unicode character", arg);
+        _PyArg_BadArgument("decomposition", "argument", "a unicode character", arg);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(arg, 0);
@@ -412,7 +412,7 @@ unicodedata_UCD_is_normalized(PyObject *self, PyObject *const *args, Py_ssize_t
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("is_normalized", 1, "str", args[0]);
+        _PyArg_BadArgument("is_normalized", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -420,7 +420,7 @@ unicodedata_UCD_is_normalized(PyObject *self, PyObject *const *args, Py_ssize_t
     }
     form = args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("is_normalized", 2, "str", args[1]);
+        _PyArg_BadArgument("is_normalized", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -459,7 +459,7 @@ unicodedata_UCD_normalize(PyObject *self, PyObject *const *args, Py_ssize_t narg
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("normalize", 1, "str", args[0]);
+        _PyArg_BadArgument("normalize", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -467,7 +467,7 @@ unicodedata_UCD_normalize(PyObject *self, PyObject *const *args, Py_ssize_t narg
     }
     form = args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("normalize", 2, "str", args[1]);
+        _PyArg_BadArgument("normalize", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -506,14 +506,14 @@ unicodedata_UCD_name(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("name", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("name", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0])) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(args[0]) != 1) {
-        _PyArg_BadArgument("name", 1, "a unicode character", args[0]);
+        _PyArg_BadArgument("name", "argument 1", "a unicode character", args[0]);
         goto exit;
     }
     chr = PyUnicode_READ_CHAR(args[0], 0);
@@ -559,4 +559,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=0fc850fe5b6b312c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3238f76814fb48d1 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
index aa579209108d..77ea04a353bf 100644
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -38,7 +38,7 @@ zlib_compress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("compress", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("compress", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -105,7 +105,7 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("decompress", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -273,7 +273,7 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&zdict, 'C')) {
-        _PyArg_BadArgument("compressobj", 6, "contiguous buffer", args[5]);
+        _PyArg_BadArgument("compressobj", "argument 'zdict'", "contiguous buffer", args[5]);
         goto exit;
     }
 skip_optional_pos:
@@ -375,7 +375,7 @@ zlib_Compress_compress(compobject *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("compress", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("compress", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = zlib_Compress_compress_impl(self, &data);
@@ -432,7 +432,7 @@ zlib_Decompress_decompress(compobject *self, PyObject *const *args, Py_ssize_t n
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("decompress", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (!noptargs) {
@@ -677,7 +677,7 @@ zlib_adler32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("adler32", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("adler32", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -735,7 +735,7 @@ zlib_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("crc32", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("crc32", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (nargs < 2) {
@@ -785,4 +785,4 @@ zlib_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 #ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
     #define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
 #endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
-/*[clinic end generated code: output=feb079cebbbaacd6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=faae38ef96b88b16 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h
index 08c6eb53f587..ad8ed7eba7e8 100644
--- a/Objects/clinic/bytearrayobject.c.h
+++ b/Objects/clinic/bytearrayobject.c.h
@@ -115,14 +115,14 @@ bytearray_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&frm, 'C')) {
-        _PyArg_BadArgument("maketrans", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("maketrans", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &to, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&to, 'C')) {
-        _PyArg_BadArgument("maketrans", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("maketrans", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = bytearray_maketrans_impl(&frm, &to);
@@ -175,14 +175,14 @@ bytearray_replace(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nar
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&old, 'C')) {
-        _PyArg_BadArgument("replace", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("replace", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &new, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&new, 'C')) {
-        _PyArg_BadArgument("replace", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("replace", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -735,7 +735,7 @@ bytearray_decode(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
     }
     if (args[0]) {
         if (!PyUnicode_Check(args[0])) {
-            _PyArg_BadArgument("decode", 1, "str", args[0]);
+            _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -752,7 +752,7 @@ bytearray_decode(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
         }
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("decode", 2, "str", args[1]);
+        _PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]);
         goto exit;
     }
     Py_ssize_t errors_length;
@@ -854,7 +854,7 @@ bytearray_fromhex(PyTypeObject *type, PyObject *arg)
     PyObject *string;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("fromhex", 0, "str", arg);
+        _PyArg_BadArgument("fromhex", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -1011,4 +1011,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
 {
     return bytearray_sizeof_impl(self);
 }
-/*[clinic end generated code: output=7848247e5469ba1b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=09df354d3374dfb2 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
index 69c35063c6cf..7e2ce1af285c 100644
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -99,7 +99,7 @@ bytes_partition(PyBytesObject *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&sep, 'C')) {
-        _PyArg_BadArgument("partition", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("partition", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = bytes_partition_impl(self, &sep);
@@ -142,7 +142,7 @@ bytes_rpartition(PyBytesObject *self, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&sep, 'C')) {
-        _PyArg_BadArgument("rpartition", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("rpartition", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = bytes_rpartition_impl(self, &sep);
@@ -420,14 +420,14 @@ bytes_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&frm, 'C')) {
-        _PyArg_BadArgument("maketrans", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("maketrans", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &to, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&to, 'C')) {
-        _PyArg_BadArgument("maketrans", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("maketrans", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = bytes_maketrans_impl(&frm, &to);
@@ -480,14 +480,14 @@ bytes_replace(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&old, 'C')) {
-        _PyArg_BadArgument("replace", 1, "contiguous buffer", args[0]);
+        _PyArg_BadArgument("replace", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &new, PyBUF_SIMPLE) != 0) {
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&new, 'C')) {
-        _PyArg_BadArgument("replace", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("replace", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
     if (nargs < 3) {
@@ -568,7 +568,7 @@ bytes_decode(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
     }
     if (args[0]) {
         if (!PyUnicode_Check(args[0])) {
-            _PyArg_BadArgument("decode", 1, "str", args[0]);
+            _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -585,7 +585,7 @@ bytes_decode(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
         }
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("decode", 2, "str", args[1]);
+        _PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]);
         goto exit;
     }
     Py_ssize_t errors_length;
@@ -674,7 +674,7 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
     PyObject *string;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("fromhex", 0, "str", arg);
+        _PyArg_BadArgument("fromhex", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -755,4 +755,4 @@ bytes_hex(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=2d0a3733e13e753a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dbed3c3ff6faa382 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/codeobject.c.h b/Objects/clinic/codeobject.c.h
index ec127ce17189..6596de051cac 100644
--- a/Objects/clinic/codeobject.c.h
+++ b/Objects/clinic/codeobject.c.h
@@ -158,7 +158,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[7]) {
         if (!PyBytes_Check(args[7])) {
-            _PyArg_BadArgument("replace", 8, "bytes", args[7]);
+            _PyArg_BadArgument("replace", "argument 'co_code'", "bytes", args[7]);
             goto exit;
         }
         co_code = (PyBytesObject *)args[7];
@@ -168,7 +168,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[8]) {
         if (!PyTuple_Check(args[8])) {
-            _PyArg_BadArgument("replace", 9, "tuple", args[8]);
+            _PyArg_BadArgument("replace", "argument 'co_consts'", "tuple", args[8]);
             goto exit;
         }
         co_consts = args[8];
@@ -178,7 +178,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[9]) {
         if (!PyTuple_Check(args[9])) {
-            _PyArg_BadArgument("replace", 10, "tuple", args[9]);
+            _PyArg_BadArgument("replace", "argument 'co_names'", "tuple", args[9]);
             goto exit;
         }
         co_names = args[9];
@@ -188,7 +188,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[10]) {
         if (!PyTuple_Check(args[10])) {
-            _PyArg_BadArgument("replace", 11, "tuple", args[10]);
+            _PyArg_BadArgument("replace", "argument 'co_varnames'", "tuple", args[10]);
             goto exit;
         }
         co_varnames = args[10];
@@ -198,7 +198,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[11]) {
         if (!PyTuple_Check(args[11])) {
-            _PyArg_BadArgument("replace", 12, "tuple", args[11]);
+            _PyArg_BadArgument("replace", "argument 'co_freevars'", "tuple", args[11]);
             goto exit;
         }
         co_freevars = args[11];
@@ -208,7 +208,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[12]) {
         if (!PyTuple_Check(args[12])) {
-            _PyArg_BadArgument("replace", 13, "tuple", args[12]);
+            _PyArg_BadArgument("replace", "argument 'co_cellvars'", "tuple", args[12]);
             goto exit;
         }
         co_cellvars = args[12];
@@ -218,7 +218,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[13]) {
         if (!PyUnicode_Check(args[13])) {
-            _PyArg_BadArgument("replace", 14, "str", args[13]);
+            _PyArg_BadArgument("replace", "argument 'co_filename'", "str", args[13]);
             goto exit;
         }
         if (PyUnicode_READY(args[13]) == -1) {
@@ -231,7 +231,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
     }
     if (args[14]) {
         if (!PyUnicode_Check(args[14])) {
-            _PyArg_BadArgument("replace", 15, "str", args[14]);
+            _PyArg_BadArgument("replace", "argument 'co_name'", "str", args[14]);
             goto exit;
         }
         if (PyUnicode_READY(args[14]) == -1) {
@@ -243,7 +243,7 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
         }
     }
     if (!PyBytes_Check(args[15])) {
-        _PyArg_BadArgument("replace", 16, "bytes", args[15]);
+        _PyArg_BadArgument("replace", "argument 'co_lnotab'", "bytes", args[15]);
         goto exit;
     }
     co_lnotab = (PyBytesObject *)args[15];
@@ -253,4 +253,4 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=624ab6f2ea8f0ea4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fade581d6313a0c2 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h
index 4251d63c247b..6515d118e506 100644
--- a/Objects/clinic/floatobject.c.h
+++ b/Objects/clinic/floatobject.c.h
@@ -235,7 +235,7 @@ float___getformat__(PyTypeObject *type, PyObject *arg)
     const char *typestr;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("__getformat__", 0, "str", arg);
+        _PyArg_BadArgument("__getformat__", "argument", "str", arg);
         goto exit;
     }
     Py_ssize_t typestr_length;
@@ -289,7 +289,7 @@ float___set_format__(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("__set_format__", 1, "str", args[0]);
+        _PyArg_BadArgument("__set_format__", "argument 1", "str", args[0]);
         goto exit;
     }
     Py_ssize_t typestr_length;
@@ -302,7 +302,7 @@ float___set_format__(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs
         goto exit;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("__set_format__", 2, "str", args[1]);
+        _PyArg_BadArgument("__set_format__", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t fmt_length;
@@ -339,7 +339,7 @@ float___format__(PyObject *self, PyObject *arg)
     PyObject *format_spec;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("__format__", 0, "str", arg);
+        _PyArg_BadArgument("__format__", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -351,4 +351,4 @@ float___format__(PyObject *self, PyObject *arg)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=c183029d87dd41fa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=cc8098eb73f1a64c input=a9049054013a1b77]*/
diff --git a/Objects/clinic/funcobject.c.h b/Objects/clinic/funcobject.c.h
index 929797bfb02d..17fb13fe085a 100644
--- a/Objects/clinic/funcobject.c.h
+++ b/Objects/clinic/funcobject.c.h
@@ -44,12 +44,12 @@ func_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
         goto exit;
     }
     if (!PyObject_TypeCheck(fastargs[0], &PyCode_Type)) {
-        _PyArg_BadArgument("function", 1, (&PyCode_Type)->tp_name, fastargs[0]);
+        _PyArg_BadArgument("function", "argument 'code'", (&PyCode_Type)->tp_name, fastargs[0]);
         goto exit;
     }
     code = (PyCodeObject *)fastargs[0];
     if (!PyDict_Check(fastargs[1])) {
-        _PyArg_BadArgument("function", 2, "dict", fastargs[1]);
+        _PyArg_BadArgument("function", "argument 'globals'", "dict", fastargs[1]);
         goto exit;
     }
     globals = fastargs[1];
@@ -75,4 +75,4 @@ func_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=1d01072cd5620d7e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3d96afa3396e5c82 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h
index 453edba481df..27e8dfe935b6 100644
--- a/Objects/clinic/longobject.c.h
+++ b/Objects/clinic/longobject.c.h
@@ -74,7 +74,7 @@ int___format__(PyObject *self, PyObject *arg)
     PyObject *format_spec;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("__format__", 0, "str", arg);
+        _PyArg_BadArgument("__format__", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -227,7 +227,7 @@ int_to_bytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
         length = ival;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("to_bytes", 2, "str", args[1]);
+        _PyArg_BadArgument("to_bytes", "argument 'byteorder'", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -293,7 +293,7 @@ int_from_bytes(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyOb
     }
     bytes_obj = args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("from_bytes", 2, "str", args[1]);
+        _PyArg_BadArgument("from_bytes", "argument 'byteorder'", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -313,4 +313,4 @@ int_from_bytes(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyOb
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=709503897c55bca1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=77bc3b2615822cb8 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/moduleobject.c.h b/Objects/clinic/moduleobject.c.h
index 512edee72fea..c1534eaee258 100644
--- a/Objects/clinic/moduleobject.c.h
+++ b/Objects/clinic/moduleobject.c.h
@@ -31,7 +31,7 @@ module___init__(PyObject *self, PyObject *args, PyObject *kwargs)
         goto exit;
     }
     if (!PyUnicode_Check(fastargs[0])) {
-        _PyArg_BadArgument("module", 1, "str", fastargs[0]);
+        _PyArg_BadArgument("module", "argument 'name'", "str", fastargs[0]);
         goto exit;
     }
     if (PyUnicode_READY(fastargs[0]) == -1) {
@@ -48,4 +48,4 @@ module___init__(PyObject *self, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=d7b7ca1237597b08 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=680276bc3a496d7a input=a9049054013a1b77]*/
diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h
index fbe1261fb5a0..357eb44b12b8 100644
--- a/Objects/clinic/typeobject.c.h
+++ b/Objects/clinic/typeobject.c.h
@@ -200,7 +200,7 @@ object___format__(PyObject *self, PyObject *arg)
     PyObject *format_spec;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("__format__", 0, "str", arg);
+        _PyArg_BadArgument("__format__", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -248,4 +248,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored))
 {
     return object___dir___impl(self);
 }
-/*[clinic end generated code: output=ea5734413064fa7e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7a6d272d282308f3 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h
index 647507dea61a..cb350874dad1 100644
--- a/Objects/clinic/unicodeobject.c.h
+++ b/Objects/clinic/unicodeobject.c.h
@@ -157,7 +157,7 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
     }
     if (args[0]) {
         if (!PyUnicode_Check(args[0])) {
-            _PyArg_BadArgument("encode", 1, "str", args[0]);
+            _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[0]);
             goto exit;
         }
         Py_ssize_t encoding_length;
@@ -174,7 +174,7 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
         }
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("encode", 2, "str", args[1]);
+        _PyArg_BadArgument("encode", "argument 'errors'", "str", args[1]);
         goto exit;
     }
     Py_ssize_t errors_length;
@@ -712,7 +712,7 @@ unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("replace", 1, "str", args[0]);
+        _PyArg_BadArgument("replace", "argument 1", "str", args[0]);
         goto exit;
     }
     if (PyUnicode_READY(args[0]) == -1) {
@@ -720,7 +720,7 @@ unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
     }
     old = args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("replace", 2, "str", args[1]);
+        _PyArg_BadArgument("replace", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -1080,7 +1080,7 @@ unicode_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("maketrans", 2, "str", args[1]);
+        _PyArg_BadArgument("maketrans", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -1091,7 +1091,7 @@ unicode_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("maketrans", 3, "str", args[2]);
+        _PyArg_BadArgument("maketrans", "argument 3", "str", args[2]);
         goto exit;
     }
     if (PyUnicode_READY(args[2]) == -1) {
@@ -1202,7 +1202,7 @@ unicode___format__(PyObject *self, PyObject *arg)
     PyObject *format_spec;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("__format__", 0, "str", arg);
+        _PyArg_BadArgument("__format__", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -1232,4 +1232,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
 {
     return unicode_sizeof_impl(self);
 }
-/*[clinic end generated code: output=d1541724cb4a0070 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d9a6ee45ddd0ccfd input=a9049054013a1b77]*/
diff --git a/Objects/stringlib/clinic/transmogrify.h.h b/Objects/stringlib/clinic/transmogrify.h.h
index 0c53a75b1bf8..8a3a060f12bc 100644
--- a/Objects/stringlib/clinic/transmogrify.h.h
+++ b/Objects/stringlib/clinic/transmogrify.h.h
@@ -100,7 +100,7 @@ stringlib_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         fillchar = PyByteArray_AS_STRING(args[1])[0];
     }
     else {
-        _PyArg_BadArgument("ljust", 2, "a byte string of length 1", args[1]);
+        _PyArg_BadArgument("ljust", "argument 2", "a byte string of length 1", args[1]);
         goto exit;
     }
 skip_optional:
@@ -161,7 +161,7 @@ stringlib_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         fillchar = PyByteArray_AS_STRING(args[1])[0];
     }
     else {
-        _PyArg_BadArgument("rjust", 2, "a byte string of length 1", args[1]);
+        _PyArg_BadArgument("rjust", "argument 2", "a byte string of length 1", args[1]);
         goto exit;
     }
 skip_optional:
@@ -222,7 +222,7 @@ stringlib_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
         fillchar = PyByteArray_AS_STRING(args[1])[0];
     }
     else {
-        _PyArg_BadArgument("center", 2, "a byte string of length 1", args[1]);
+        _PyArg_BadArgument("center", "argument 2", "a byte string of length 1", args[1]);
         goto exit;
     }
 skip_optional:
@@ -274,4 +274,4 @@ stringlib_zfill(PyObject *self, PyObject *arg)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=96cbb19b238d0e84 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=15be047aef999b4e input=a9049054013a1b77]*/
diff --git a/PC/clinic/_testconsole.c.h b/PC/clinic/_testconsole.c.h
index a37d1235a02a..cf5e4ee09063 100644
--- a/PC/clinic/_testconsole.c.h
+++ b/PC/clinic/_testconsole.c.h
@@ -33,7 +33,7 @@ _testconsole_write_input(PyObject *module, PyObject *const *args, Py_ssize_t nar
     }
     file = args[0];
     if (!PyBytes_Check(args[1])) {
-        _PyArg_BadArgument("write_input", 2, "bytes", args[1]);
+        _PyArg_BadArgument("write_input", "argument 's'", "bytes", args[1]);
         goto exit;
     }
     s = (PyBytesObject *)args[1];
@@ -88,4 +88,4 @@ _testconsole_read_output(PyObject *module, PyObject *const *args, Py_ssize_t nar
 #ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
     #define _TESTCONSOLE_READ_OUTPUT_METHODDEF
 #endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
-/*[clinic end generated code: output=ef452d5fb9287fc2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dd8b093a91b62753 input=a9049054013a1b77]*/
diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h
index d8e77d5f328d..180c3e5fc54a 100644
--- a/PC/clinic/msvcrtmodule.c.h
+++ b/PC/clinic/msvcrtmodule.c.h
@@ -375,7 +375,7 @@ msvcrt_putch(PyObject *module, PyObject *arg)
         char_value = PyByteArray_AS_STRING(arg)[0];
     }
     else {
-        _PyArg_BadArgument("putch", 0, "a byte string of length 1", arg);
+        _PyArg_BadArgument("putch", "argument", "a byte string of length 1", arg);
         goto exit;
     }
     return_value = msvcrt_putch_impl(module, char_value);
@@ -403,14 +403,14 @@ msvcrt_putwch(PyObject *module, PyObject *arg)
     int unicode_char;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("putwch", 0, "a unicode character", arg);
+        _PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("putwch", 0, "a unicode character", arg);
+        _PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
         goto exit;
     }
     unicode_char = PyUnicode_READ_CHAR(arg, 0);
@@ -449,7 +449,7 @@ msvcrt_ungetch(PyObject *module, PyObject *arg)
         char_value = PyByteArray_AS_STRING(arg)[0];
     }
     else {
-        _PyArg_BadArgument("ungetch", 0, "a byte string of length 1", arg);
+        _PyArg_BadArgument("ungetch", "argument", "a byte string of length 1", arg);
         goto exit;
     }
     return_value = msvcrt_ungetch_impl(module, char_value);
@@ -477,14 +477,14 @@ msvcrt_ungetwch(PyObject *module, PyObject *arg)
     int unicode_char;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("ungetwch", 0, "a unicode character", arg);
+        _PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg)) {
         goto exit;
     }
     if (PyUnicode_GET_LENGTH(arg) != 1) {
-        _PyArg_BadArgument("ungetwch", 0, "a unicode character", arg);
+        _PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
         goto exit;
     }
     unicode_char = PyUnicode_READ_CHAR(arg, 0);
@@ -679,4 +679,4 @@ msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
 #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
     #define MSVCRT_SET_ERROR_MODE_METHODDEF
 #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
-/*[clinic end generated code: output=816bc4f993893cea input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7cc6ffaf64f268f7 input=a9049054013a1b77]*/
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h
index abed6cc3e174..49608ccf3df9 100644
--- a/Python/clinic/bltinmodule.c.h
+++ b/Python/clinic/bltinmodule.c.h
@@ -102,7 +102,7 @@ builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto skip_optional;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("format", 2, "str", args[1]);
+        _PyArg_BadArgument("format", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -200,7 +200,7 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
         goto exit;
     }
     if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("compile", 3, "str", args[2]);
+        _PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]);
         goto exit;
     }
     Py_ssize_t mode_length;
@@ -849,4 +849,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=e173df340a9e4516 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1927f3c9abd00c35 input=a9049054013a1b77]*/
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index 05e3106bb39a..743d00222914 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -92,12 +92,12 @@ _imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
         goto exit;
     }
     if (!PyObject_TypeCheck(args[0], &PyCode_Type)) {
-        _PyArg_BadArgument("_fix_co_filename", 1, (&PyCode_Type)->tp_name, args[0]);
+        _PyArg_BadArgument("_fix_co_filename", "argument 1", (&PyCode_Type)->tp_name, args[0]);
         goto exit;
     }
     code = (PyCodeObject *)args[0];
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("_fix_co_filename", 2, "str", args[1]);
+        _PyArg_BadArgument("_fix_co_filename", "argument 2", "str", args[1]);
         goto exit;
     }
     if (PyUnicode_READY(args[1]) == -1) {
@@ -156,7 +156,7 @@ _imp_init_frozen(PyObject *module, PyObject *arg)
     PyObject *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("init_frozen", 0, "str", arg);
+        _PyArg_BadArgument("init_frozen", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -188,7 +188,7 @@ _imp_get_frozen_object(PyObject *module, PyObject *arg)
     PyObject *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("get_frozen_object", 0, "str", arg);
+        _PyArg_BadArgument("get_frozen_object", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -220,7 +220,7 @@ _imp_is_frozen_package(PyObject *module, PyObject *arg)
     PyObject *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("is_frozen_package", 0, "str", arg);
+        _PyArg_BadArgument("is_frozen_package", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -252,7 +252,7 @@ _imp_is_builtin(PyObject *module, PyObject *arg)
     PyObject *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("is_builtin", 0, "str", arg);
+        _PyArg_BadArgument("is_builtin", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -284,7 +284,7 @@ _imp_is_frozen(PyObject *module, PyObject *arg)
     PyObject *name;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("is_frozen", 0, "str", arg);
+        _PyArg_BadArgument("is_frozen", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -433,7 +433,7 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&source, 'C')) {
-        _PyArg_BadArgument("source_hash", 2, "contiguous buffer", args[1]);
+        _PyArg_BadArgument("source_hash", "argument 'source'", "contiguous buffer", args[1]);
         goto exit;
     }
     return_value = _imp_source_hash_impl(module, key, &source);
@@ -454,4 +454,4 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
 #ifndef _IMP_EXEC_DYNAMIC_METHODDEF
     #define _IMP_EXEC_DYNAMIC_METHODDEF
 #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=b51244770fdcf4b8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ff06f7cf4b73eb76 input=a9049054013a1b77]*/
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h
index ab4575340e25..05d4830c4ab3 100644
--- a/Python/clinic/marshal.c.h
+++ b/Python/clinic/marshal.c.h
@@ -152,7 +152,7 @@ marshal_loads(PyObject *module, PyObject *arg)
         goto exit;
     }
     if (!PyBuffer_IsContiguous(&bytes, 'C')) {
-        _PyArg_BadArgument("loads", 0, "contiguous buffer", arg);
+        _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg);
         goto exit;
     }
     return_value = marshal_loads_impl(module, &bytes);
@@ -165,4 +165,4 @@ marshal_loads(PyObject *module, PyObject *arg)
 
     return return_value;
 }
-/*[clinic end generated code: output=ae2bca1aa239e095 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/
diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h
index 563332eeb5c6..93bc3320e337 100644
--- a/Python/clinic/sysmodule.c.h
+++ b/Python/clinic/sysmodule.c.h
@@ -228,7 +228,7 @@ sys_intern(PyObject *module, PyObject *arg)
     PyObject *s;
 
     if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("intern", 0, "str", arg);
+        _PyArg_BadArgument("intern", "argument", "str", arg);
         goto exit;
     }
     if (PyUnicode_READY(arg) == -1) {
@@ -931,7 +931,7 @@ sys_call_tracing(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     }
     func = args[0];
     if (!PyTuple_Check(args[1])) {
-        _PyArg_BadArgument("call_tracing", 2, "tuple", args[1]);
+        _PyArg_BadArgument("call_tracing", "argument 2", "tuple", args[1]);
         goto exit;
     }
     funcargs = args[1];
@@ -1088,4 +1088,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
 #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
     #define SYS_GETANDROIDAPILEVEL_METHODDEF
 #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
-/*[clinic end generated code: output=1a67b37c4486d65f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=092edc868de055a6 input=a9049054013a1b77]*/
diff --git a/Python/clinic/traceback.c.h b/Python/clinic/traceback.c.h
index 2815f65d3dd1..04daf2a37669 100644
--- a/Python/clinic/traceback.c.h
+++ b/Python/clinic/traceback.c.h
@@ -32,7 +32,7 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     }
     tb_next = fastargs[0];
     if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) {
-        _PyArg_BadArgument("TracebackType", 2, (&PyFrame_Type)->tp_name, fastargs[1]);
+        _PyArg_BadArgument("TracebackType", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
         goto exit;
     }
     tb_frame = (PyFrameObject *)fastargs[1];
@@ -59,4 +59,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=7e4c0e252d0973b0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/
diff --git a/Python/getargs.c b/Python/getargs.c
index 051ebc78a0f8..c65530d859c3 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -610,24 +610,18 @@ convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags,
 
 
 
-/* Format an error message generated by convertsimple(). */
+/* Format an error message generated by convertsimple().
+   displayname must be UTF-8 encoded.
+*/
 
 void
-_PyArg_BadArgument(const char *fname, int iarg,
+_PyArg_BadArgument(const char *fname, const char *displayname,
                    const char *expected, PyObject *arg)
 {
-    if (iarg) {
-        PyErr_Format(PyExc_TypeError,
-                     "%.200s() argument %d must be %.50s, not %.50s",
-                     fname, iarg, expected,
-                     arg == Py_None ? "None" : arg->ob_type->tp_name);
-    }
-    else {
-        PyErr_Format(PyExc_TypeError,
-                     "%.200s() argument must be %.50s, not %.50s",
-                     fname, expected,
-                     arg == Py_None ? "None" : arg->ob_type->tp_name);
-    }
+    PyErr_Format(PyExc_TypeError,
+                 "%.200s() %.200s must be %.50s, not %.50s",
+                 fname, displayname, expected,
+                 arg == Py_None ? "None" : arg->ob_type->tp_name);
 }
 
 static const char *
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index d5863a3effe9..cec7c5392db3 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -806,7 +806,8 @@ def parser_body(prototype, *fields, declarations=''):
                     {c_basename}({self_type}{self_name}, PyObject *%s)
                     """ % argname)
 
-                parsearg = converters[0].parse_arg(argname, 0)
+                displayname = parameters[0].get_displayname(0)
+                parsearg = converters[0].parse_arg(argname, displayname)
                 if parsearg is None:
                     parsearg = """
                         if (!PyArg_Parse(%s, "{format_units}:{name}", {parse_arguments})) {{
@@ -851,7 +852,8 @@ def parser_body(prototype, *fields, declarations=''):
                 """ % (nargs, min_pos, max_pos), indent=4)]
             has_optional = False
             for i, p in enumerate(parameters):
-                parsearg = p.converter.parse_arg(argname_fmt % i, i + 1)
+                displayname = p.get_displayname(i+1)
+                parsearg = p.converter.parse_arg(argname_fmt % i, displayname)
                 if parsearg is None:
                     #print('Cannot convert %s %r for %s' % (p.converter.__class__.__name__, p.converter.format_unit, p.converter.name), file=sys.stderr)
                     parser_code = None
@@ -927,7 +929,8 @@ def parser_body(prototype, *fields, declarations=''):
 
             add_label = None
             for i, p in enumerate(parameters):
-                parsearg = p.converter.parse_arg(argname_fmt % i, i + 1)
+                displayname = p.get_displayname(i+1)
+                parsearg = p.converter.parse_arg(argname_fmt % i, displayname)
                 if parsearg is None:
                     #print('Cannot convert %s %r for %s' % (p.converter.__class__.__name__, p.converter.format_unit, p.converter.name), file=sys.stderr)
                     parser_code = None
@@ -2287,6 +2290,13 @@ def copy(self, **overrides):
             kwargs['converter'] = converter
         return Parameter(**kwargs)
 
+    def get_displayname(self, i):
+        if i == 0:
+            return '"argument"'
+        if not self.is_positional_only():
+            return '''"argument '{}'"'''.format(self.name)
+        else:
+            return '"argument {}"'.format(i)
 
 
 class LandMine:
@@ -2634,7 +2644,7 @@ def pre_render(self):
         """
         pass
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'O&':
             return """
                 if (!{converter}({argname}, &{paramname})) {{{{
@@ -2648,21 +2658,22 @@ def parse_arg(self, argname, argnum):
                 typecheck, typename = type_checks[self.subclass_of]
                 return """
                     if (!{typecheck}({argname})) {{{{
-                        _PyArg_BadArgument("{{name}}", {argnum}, "{typename}", {argname});
+                        _PyArg_BadArgument("{{name}}", {displayname}, "{typename}", {argname});
                         goto exit;
                     }}}}
                     {paramname} = {cast}{argname};
                     """.format(argname=argname, paramname=self.name,
-                               argnum=argnum,
-                               typecheck=typecheck, typename=typename, cast=cast)
+                               displayname=displayname, typecheck=typecheck,
+                               typename=typename, cast=cast)
             return """
                 if (!PyObject_TypeCheck({argname}, {subclass_of})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, ({subclass_of})->tp_name, {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, ({subclass_of})->tp_name, {argname});
                     goto exit;
                 }}}}
                 {paramname} = {cast}{argname};
-                """.format(argname=argname, paramname=self.name, argnum=argnum,
-                           subclass_of=self.subclass_of, cast=cast)
+                """.format(argname=argname, paramname=self.name,
+                           subclass_of=self.subclass_of, cast=cast,
+                           displayname=displayname)
         if self.format_unit == 'O':
             cast = '(%s)' % self.type if self.type != 'PyObject *' else ''
             return """
@@ -2698,7 +2709,7 @@ def converter_init(self, *, accept={object}):
             self.default = bool(self.default)
             self.c_default = str(int(self.default))
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'i':
             # XXX PyFloat_Check can be removed after the end of the
             # deprecation in _PyLong_FromNbIndexOrNbInt.
@@ -2720,7 +2731,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class char_converter(CConverter):
     type = 'char'
@@ -2737,7 +2748,7 @@ def converter_init(self):
             if self.c_default == '"\'"':
                 self.c_default = r"'\''"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'c':
             return """
                 if (PyBytes_Check({argname}) && PyBytes_GET_SIZE({argname}) == 1) {{{{
@@ -2747,11 +2758,12 @@ def parse_arg(self, argname, argnum):
                     {paramname} = PyByteArray_AS_STRING({argname})[0];
                 }}}}
                 else {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "a byte string of length 1", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "a byte string of length 1", {argname});
                     goto exit;
                 }}}}
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 
 @add_legacy_c_converter('B', bitwise=True)
@@ -2765,7 +2777,7 @@ def converter_init(self, *, bitwise=False):
         if bitwise:
             self.format_unit = 'B'
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'b':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -2810,7 +2822,7 @@ def parse_arg(self, argname, argnum):
                     }}}}
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class byte_converter(unsigned_char_converter): pass
 
@@ -2820,7 +2832,7 @@ class short_converter(CConverter):
     format_unit = 'h'
     c_ignored_default = "0"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'h':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -2848,7 +2860,7 @@ def parse_arg(self, argname, argnum):
                     }}}}
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class unsigned_short_converter(CConverter):
     type = 'unsigned short'
@@ -2861,7 +2873,7 @@ def converter_init(self, *, bitwise=False):
         else:
             self.converter = '_PyLong_UnsignedShort_Converter'
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'H':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -2874,7 +2886,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 @add_legacy_c_converter('C', accept={str})
 class int_converter(CConverter):
@@ -2891,7 +2903,7 @@ def converter_init(self, *, accept={int}, type=None):
         if type != None:
             self.type = type
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'i':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -2907,19 +2919,20 @@ def parse_arg(self, argname, argnum):
         elif self.format_unit == 'C':
             return """
                 if (!PyUnicode_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "a unicode character", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "a unicode character", {argname});
                     goto exit;
                 }}}}
                 if (PyUnicode_READY({argname})) {{{{
                     goto exit;
                 }}}}
                 if (PyUnicode_GET_LENGTH({argname}) != 1) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "a unicode character", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "a unicode character", {argname});
                     goto exit;
                 }}}}
                 {paramname} = PyUnicode_READ_CHAR({argname}, 0);
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 class unsigned_int_converter(CConverter):
     type = 'unsigned int'
@@ -2932,7 +2945,7 @@ def converter_init(self, *, bitwise=False):
         else:
             self.converter = '_PyLong_UnsignedInt_Converter'
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'I':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -2945,7 +2958,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class long_converter(CConverter):
     type = 'long'
@@ -2953,7 +2966,7 @@ class long_converter(CConverter):
     format_unit = 'l'
     c_ignored_default = "0"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'l':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -2966,7 +2979,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class unsigned_long_converter(CConverter):
     type = 'unsigned long'
@@ -2979,16 +2992,17 @@ def converter_init(self, *, bitwise=False):
         else:
             self.converter = '_PyLong_UnsignedLong_Converter'
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'k':
             return """
                 if (!PyLong_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "int", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "int", {argname});
                     goto exit;
                 }}}}
                 {paramname} = PyLong_AsUnsignedLongMask({argname});
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 class long_long_converter(CConverter):
     type = 'long long'
@@ -2996,7 +3010,7 @@ class long_long_converter(CConverter):
     format_unit = 'L'
     c_ignored_default = "0"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'L':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -3009,7 +3023,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class unsigned_long_long_converter(CConverter):
     type = 'unsigned long long'
@@ -3022,16 +3036,17 @@ def converter_init(self, *, bitwise=False):
         else:
             self.converter = '_PyLong_UnsignedLongLong_Converter'
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'K':
             return """
                 if (!PyLong_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "int", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "int", {argname});
                     goto exit;
                 }}}}
                 {paramname} = PyLong_AsUnsignedLongLongMask({argname});
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 class Py_ssize_t_converter(CConverter):
     type = 'Py_ssize_t'
@@ -3046,7 +3061,7 @@ def converter_init(self, *, accept={int}):
         else:
             fail("Py_ssize_t_converter: illegal 'accept' argument " + repr(accept))
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'n':
             return """
                 if (PyFloat_Check({argname})) {{{{
@@ -3067,7 +3082,7 @@ def parse_arg(self, argname, argnum):
                     {paramname} = ival;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 
 class slice_index_converter(CConverter):
@@ -3086,7 +3101,7 @@ class size_t_converter(CConverter):
     converter = '_PyLong_Size_t_Converter'
     c_ignored_default = "0"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'n':
             return """
                 {paramname} = PyNumber_AsSsize_t({argname}, PyExc_OverflowError);
@@ -3094,7 +3109,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 
 class float_converter(CConverter):
@@ -3103,7 +3118,7 @@ class float_converter(CConverter):
     format_unit = 'f'
     c_ignored_default = "0.0"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'f':
             return """
                 if (PyFloat_CheckExact({argname})) {{{{
@@ -3117,7 +3132,7 @@ def parse_arg(self, argname, argnum):
                     }}}}
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 class double_converter(CConverter):
     type = 'double'
@@ -3125,7 +3140,7 @@ class double_converter(CConverter):
     format_unit = 'd'
     c_ignored_default = "0.0"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'd':
             return """
                 if (PyFloat_CheckExact({argname})) {{{{
@@ -3139,7 +3154,7 @@ def parse_arg(self, argname, argnum):
                     }}}}
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 
 class Py_complex_converter(CConverter):
@@ -3148,7 +3163,7 @@ class Py_complex_converter(CConverter):
     format_unit = 'D'
     c_ignored_default = "{0.0, 0.0}"
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'D':
             return """
                 {paramname} = PyComplex_AsCComplex({argname});
@@ -3156,7 +3171,7 @@ def parse_arg(self, argname, argnum):
                     goto exit;
                 }}}}
                 """.format(argname=argname, paramname=self.name)
-        return super().parse_arg(argname, argnum)
+        return super().parse_arg(argname, displayname)
 
 
 class object_converter(CConverter):
@@ -3222,11 +3237,11 @@ def cleanup(self):
             name = self.name
             return "".join(["if (", name, ") {\n   PyMem_FREE(", name, ");\n}\n"])
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 's':
             return """
                 if (!PyUnicode_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "str", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "str", {argname});
                     goto exit;
                 }}}}
                 Py_ssize_t {paramname}_length;
@@ -3238,7 +3253,8 @@ def parse_arg(self, argname, argnum):
                     PyErr_SetString(PyExc_ValueError, "embedded null character");
                     goto exit;
                 }}}}
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
         if self.format_unit == 'z':
             return """
                 if ({argname} == Py_None) {{{{
@@ -3256,11 +3272,12 @@ def parse_arg(self, argname, argnum):
                     }}}}
                 }}}}
                 else {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "str or None", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "str or None", {argname});
                     goto exit;
                 }}}}
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 #
 # This is the fourth or fifth rewrite of registering all the
@@ -3315,53 +3332,54 @@ class PyBytesObject_converter(CConverter):
     format_unit = 'S'
     # accept = {bytes}
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'S':
             return """
                 if (!PyBytes_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "bytes", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "bytes", {argname});
                     goto exit;
                 }}}}
                 {paramname} = ({type}){argname};
-                """.format(argname=argname, paramname=self.name, argnum=argnum,
-                           type=self.type)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           type=self.type, displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 class PyByteArrayObject_converter(CConverter):
     type = 'PyByteArrayObject *'
     format_unit = 'Y'
     # accept = {bytearray}
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'Y':
             return """
                 if (!PyByteArray_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "bytearray", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "bytearray", {argname});
                     goto exit;
                 }}}}
                 {paramname} = ({type}){argname};
-                """.format(argname=argname, paramname=self.name, argnum=argnum,
-                           type=self.type)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           type=self.type, displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 class unicode_converter(CConverter):
     type = 'PyObject *'
     default_type = (str, Null, NoneType)
     format_unit = 'U'
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'U':
             return """
                 if (!PyUnicode_Check({argname})) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "str", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "str", {argname});
                     goto exit;
                 }}}}
                 if (PyUnicode_READY({argname}) == -1) {{{{
                     goto exit;
                 }}}}
                 {paramname} = {argname};
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 @add_legacy_c_converter('u#', zeroes=True)
 @add_legacy_c_converter('Z', accept={str, NoneType})
@@ -3410,17 +3428,18 @@ def cleanup(self):
         name = self.name
         return "".join(["if (", name, ".obj) {\n   PyBuffer_Release(&", name, ");\n}\n"])
 
-    def parse_arg(self, argname, argnum):
+    def parse_arg(self, argname, displayname):
         if self.format_unit == 'y*':
             return """
                 if (PyObject_GetBuffer({argname}, &{paramname}, PyBUF_SIMPLE) != 0) {{{{
                     goto exit;
                 }}}}
                 if (!PyBuffer_IsContiguous(&{paramname}, 'C')) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "contiguous buffer", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "contiguous buffer", {argname});
                     goto exit;
                 }}}}
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
         elif self.format_unit == 's*':
             return """
                 if (PyUnicode_Check({argname})) {{{{
@@ -3436,24 +3455,26 @@ def parse_arg(self, argname, argnum):
                         goto exit;
                     }}}}
                     if (!PyBuffer_IsContiguous(&{paramname}, 'C')) {{{{
-                        _PyArg_BadArgument("{{name}}", {argnum}, "contiguous buffer", {argname});
+                        _PyArg_BadArgument("{{name}}", {displayname}, "contiguous buffer", {argname});
                         goto exit;
                     }}}}
                 }}}}
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
         elif self.format_unit == 'w*':
             return """
                 if (PyObject_GetBuffer({argname}, &{paramname}, PyBUF_WRITABLE) < 0) {{{{
                     PyErr_Clear();
-                    _PyArg_BadArgument("{{name}}", {argnum}, "read-write bytes-like object", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "read-write bytes-like object", {argname});
                     goto exit;
                 }}}}
                 if (!PyBuffer_IsContiguous(&{paramname}, 'C')) {{{{
-                    _PyArg_BadArgument("{{name}}", {argnum}, "contiguous buffer", {argname});
+                    _PyArg_BadArgument("{{name}}", {displayname}, "contiguous buffer", {argname});
                     goto exit;
                 }}}}
-                """.format(argname=argname, paramname=self.name, argnum=argnum)
-        return super().parse_arg(argname, argnum)
+                """.format(argname=argname, paramname=self.name,
+                           displayname=displayname)
+        return super().parse_arg(argname, displayname)
 
 
 def correct_name_for_self(f):



More information about the Python-checkins mailing list