aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Lapeyre <remi.lapeyre@henki.fr>2019-08-29 16:49:08 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2019-08-29 17:49:08 +0300
commit4901fe274bc82b95dc89bcb3de8802a3dfedab32 (patch)
tree2e6e4d0b1cdcb499df7f049ebc9dbbdb9f392bbe /Modules/_io
parentbpo-37979: Add alternative to fromisoformat in documentation (GH-15596) (diff)
downloadcpython-4901fe274bc82b95dc89bcb3de8802a3dfedab32.tar.gz
cpython-4901fe274bc82b95dc89bcb3de8802a3dfedab32.tar.bz2
cpython-4901fe274bc82b95dc89bcb3de8802a3dfedab32.zip
bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593)
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/clinic/_iomodule.c.h12
-rw-r--r--Modules/_io/clinic/bufferedio.c.h20
-rw-r--r--Modules/_io/clinic/bytesio.c.h6
-rw-r--r--Modules/_io/clinic/fileio.c.h10
-rw-r--r--Modules/_io/clinic/textio.c.h8
-rw-r--r--Modules/_io/clinic/winconsoleio.c.h10
6 files changed, 33 insertions, 33 deletions
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h
index 00ad616b41f..1a9651d3408 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 d5e8c8a7481..72841fcb677 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 @@ skip_optional_pos:
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 8dd68f56137..83cd490dc59 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 @@ skip_optional_pos:
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 8016e988862..64addde57f3 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 cec9defea02..b8b507543ea 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 bb0cdc4558d..3e501a58537 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]*/