bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593)
diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h
index 647507d..cb35087 100644
--- a/Objects/clinic/unicodeobject.c.h
+++ b/Objects/clinic/unicodeobject.c.h
@@ -157,7 +157,7 @@
}
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 @@
}
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
{
return unicode_sizeof_impl(self);
}
-/*[clinic end generated code: output=d1541724cb4a0070 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d9a6ee45ddd0ccfd input=a9049054013a1b77]*/