diff options
Diffstat (limited to 'Modules/_io/clinic')
-rw-r--r-- | Modules/_io/clinic/_iomodule.c.h | 4 | ||||
-rw-r--r-- | Modules/_io/clinic/bufferedio.c.h | 67 | ||||
-rw-r--r-- | Modules/_io/clinic/bytesio.c.h | 80 | ||||
-rw-r--r-- | Modules/_io/clinic/fileio.c.h | 32 | ||||
-rw-r--r-- | Modules/_io/clinic/iobase.c.h | 32 | ||||
-rw-r--r-- | Modules/_io/clinic/stringio.c.h | 42 | ||||
-rw-r--r-- | Modules/_io/clinic/textio.c.h | 44 | ||||
-rw-r--r-- | Modules/_io/clinic/winconsoleio.c.h | 12 |
8 files changed, 221 insertions, 92 deletions
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h index f2e91a9fe6..a1ba869a04 100644 --- a/Modules/_io/clinic/_iomodule.c.h +++ b/Modules/_io/clinic/_iomodule.c.h @@ -149,7 +149,7 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int closefd = 1; PyObject *opener = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) { goto exit; } @@ -158,4 +158,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) exit: return return_value; } -/*[clinic end generated code: output=c5b8fc8b83102bbf input=a9049054013a1b77]*/ +/*[clinic end generated code: output=79fd04d9c9d8f28f input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h index 58144a4015..4337ecfaa9 100644 --- a/Modules/_io/clinic/bufferedio.c.h +++ b/Modules/_io/clinic/bufferedio.c.h @@ -91,21 +91,25 @@ PyDoc_STRVAR(_io__Buffered_peek__doc__, "\n"); #define _IO__BUFFERED_PEEK_METHODDEF \ - {"peek", (PyCFunction)_io__Buffered_peek, METH_VARARGS, _io__Buffered_peek__doc__}, + {"peek", (PyCFunction)_io__Buffered_peek, METH_FASTCALL, _io__Buffered_peek__doc__}, static PyObject * _io__Buffered_peek_impl(buffered *self, Py_ssize_t size); static PyObject * -_io__Buffered_peek(buffered *self, PyObject *args) +_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t size = 0; - if (!PyArg_ParseTuple(args, "|n:peek", + if (!_PyArg_ParseStack(args, nargs, "|n:peek", &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("peek", kwnames)) { + goto exit; + } return_value = _io__Buffered_peek_impl(self, size); exit: @@ -118,21 +122,25 @@ PyDoc_STRVAR(_io__Buffered_read__doc__, "\n"); #define _IO__BUFFERED_READ_METHODDEF \ - {"read", (PyCFunction)_io__Buffered_read, METH_VARARGS, _io__Buffered_read__doc__}, + {"read", (PyCFunction)_io__Buffered_read, METH_FASTCALL, _io__Buffered_read__doc__}, static PyObject * _io__Buffered_read_impl(buffered *self, Py_ssize_t n); static PyObject * -_io__Buffered_read(buffered *self, PyObject *args) +_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t n = -1; - if (!PyArg_ParseTuple(args, "|O&:read", + if (!_PyArg_ParseStack(args, nargs, "|O&:read", _PyIO_ConvertSsize_t, &n)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io__Buffered_read_impl(self, n); exit: @@ -140,23 +148,28 @@ exit: } PyDoc_STRVAR(_io__Buffered_read1__doc__, -"read1($self, size, /)\n" +"read1($self, size=-1, /)\n" "--\n" "\n"); #define _IO__BUFFERED_READ1_METHODDEF \ - {"read1", (PyCFunction)_io__Buffered_read1, METH_O, _io__Buffered_read1__doc__}, + {"read1", (PyCFunction)_io__Buffered_read1, METH_FASTCALL, _io__Buffered_read1__doc__}, static PyObject * _io__Buffered_read1_impl(buffered *self, Py_ssize_t n); static PyObject * -_io__Buffered_read1(buffered *self, PyObject *arg) +_io__Buffered_read1(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - Py_ssize_t n; + Py_ssize_t n = -1; + + if (!_PyArg_ParseStack(args, nargs, "|n:read1", + &n)) { + goto exit; + } - if (!PyArg_Parse(arg, "n:read1", &n)) { + if (!_PyArg_NoStackKeywords("read1", kwnames)) { goto exit; } return_value = _io__Buffered_read1_impl(self, n); @@ -233,21 +246,25 @@ PyDoc_STRVAR(_io__Buffered_readline__doc__, "\n"); #define _IO__BUFFERED_READLINE_METHODDEF \ - {"readline", (PyCFunction)_io__Buffered_readline, METH_VARARGS, _io__Buffered_readline__doc__}, + {"readline", (PyCFunction)_io__Buffered_readline, METH_FASTCALL, _io__Buffered_readline__doc__}, static PyObject * _io__Buffered_readline_impl(buffered *self, Py_ssize_t size); static PyObject * -_io__Buffered_readline(buffered *self, PyObject *args) +_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!PyArg_ParseTuple(args, "|O&:readline", + if (!_PyArg_ParseStack(args, nargs, "|O&:readline", _PyIO_ConvertSsize_t, &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readline", kwnames)) { + goto exit; + } return_value = _io__Buffered_readline_impl(self, size); exit: @@ -260,22 +277,26 @@ PyDoc_STRVAR(_io__Buffered_seek__doc__, "\n"); #define _IO__BUFFERED_SEEK_METHODDEF \ - {"seek", (PyCFunction)_io__Buffered_seek, METH_VARARGS, _io__Buffered_seek__doc__}, + {"seek", (PyCFunction)_io__Buffered_seek, METH_FASTCALL, _io__Buffered_seek__doc__}, static PyObject * _io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence); static PyObject * -_io__Buffered_seek(buffered *self, PyObject *args) +_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *targetobj; int whence = 0; - if (!PyArg_ParseTuple(args, "O|i:seek", + if (!_PyArg_ParseStack(args, nargs, "O|i:seek", &targetobj, &whence)) { goto exit; } + + if (!_PyArg_NoStackKeywords("seek", kwnames)) { + goto exit; + } return_value = _io__Buffered_seek_impl(self, targetobj, whence); exit: @@ -288,22 +309,26 @@ PyDoc_STRVAR(_io__Buffered_truncate__doc__, "\n"); #define _IO__BUFFERED_TRUNCATE_METHODDEF \ - {"truncate", (PyCFunction)_io__Buffered_truncate, METH_VARARGS, _io__Buffered_truncate__doc__}, + {"truncate", (PyCFunction)_io__Buffered_truncate, METH_FASTCALL, _io__Buffered_truncate__doc__}, static PyObject * _io__Buffered_truncate_impl(buffered *self, PyObject *pos); static PyObject * -_io__Buffered_truncate(buffered *self, PyObject *args) +_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *pos = Py_None; - if (!PyArg_UnpackTuple(args, "truncate", + if (!_PyArg_UnpackStack(args, nargs, "truncate", 0, 1, &pos)) { goto exit; } + + if (!_PyArg_NoStackKeywords("truncate", kwnames)) { + goto exit; + } return_value = _io__Buffered_truncate_impl(self, pos); exit: @@ -475,4 +500,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=a956f394ecde4cf9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e37b969b1acaa09c input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h index c64ce5c77c..656e7ecd13 100644 --- a/Modules/_io/clinic/bytesio.c.h +++ b/Modules/_io/clinic/bytesio.c.h @@ -158,22 +158,26 @@ PyDoc_STRVAR(_io_BytesIO_read__doc__, "Return an empty bytes object at EOF."); #define _IO_BYTESIO_READ_METHODDEF \ - {"read", (PyCFunction)_io_BytesIO_read, METH_VARARGS, _io_BytesIO_read__doc__}, + {"read", (PyCFunction)_io_BytesIO_read, METH_FASTCALL, _io_BytesIO_read__doc__}, static PyObject * _io_BytesIO_read_impl(bytesio *self, PyObject *arg); static PyObject * -_io_BytesIO_read(bytesio *self, PyObject *args) +_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "read", + if (!_PyArg_UnpackStack(args, nargs, "read", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io_BytesIO_read_impl(self, arg); exit: @@ -181,7 +185,7 @@ exit: } PyDoc_STRVAR(_io_BytesIO_read1__doc__, -"read1($self, size, /)\n" +"read1($self, size=-1, /)\n" "--\n" "\n" "Read at most size bytes, returned as a bytes object.\n" @@ -190,7 +194,31 @@ PyDoc_STRVAR(_io_BytesIO_read1__doc__, "Return an empty bytes object at EOF."); #define _IO_BYTESIO_READ1_METHODDEF \ - {"read1", (PyCFunction)_io_BytesIO_read1, METH_O, _io_BytesIO_read1__doc__}, + {"read1", (PyCFunction)_io_BytesIO_read1, METH_FASTCALL, _io_BytesIO_read1__doc__}, + +static PyObject * +_io_BytesIO_read1_impl(bytesio *self, PyObject *size); + +static PyObject * +_io_BytesIO_read1(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *size = Py_None; + + if (!_PyArg_UnpackStack(args, nargs, "read1", + 0, 1, + &size)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("read1", kwnames)) { + goto exit; + } + return_value = _io_BytesIO_read1_impl(self, size); + +exit: + return return_value; +} PyDoc_STRVAR(_io_BytesIO_readline__doc__, "readline($self, size=None, /)\n" @@ -203,22 +231,26 @@ PyDoc_STRVAR(_io_BytesIO_readline__doc__, "Return an empty bytes object at EOF."); #define _IO_BYTESIO_READLINE_METHODDEF \ - {"readline", (PyCFunction)_io_BytesIO_readline, METH_VARARGS, _io_BytesIO_readline__doc__}, + {"readline", (PyCFunction)_io_BytesIO_readline, METH_FASTCALL, _io_BytesIO_readline__doc__}, static PyObject * _io_BytesIO_readline_impl(bytesio *self, PyObject *arg); static PyObject * -_io_BytesIO_readline(bytesio *self, PyObject *args) +_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "readline", + if (!_PyArg_UnpackStack(args, nargs, "readline", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readline", kwnames)) { + goto exit; + } return_value = _io_BytesIO_readline_impl(self, arg); exit: @@ -236,22 +268,26 @@ PyDoc_STRVAR(_io_BytesIO_readlines__doc__, "total number of bytes in the lines returned."); #define _IO_BYTESIO_READLINES_METHODDEF \ - {"readlines", (PyCFunction)_io_BytesIO_readlines, METH_VARARGS, _io_BytesIO_readlines__doc__}, + {"readlines", (PyCFunction)_io_BytesIO_readlines, METH_FASTCALL, _io_BytesIO_readlines__doc__}, static PyObject * _io_BytesIO_readlines_impl(bytesio *self, PyObject *arg); static PyObject * -_io_BytesIO_readlines(bytesio *self, PyObject *args) +_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "readlines", + if (!_PyArg_UnpackStack(args, nargs, "readlines", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readlines", kwnames)) { + goto exit; + } return_value = _io_BytesIO_readlines_impl(self, arg); exit: @@ -303,22 +339,26 @@ PyDoc_STRVAR(_io_BytesIO_truncate__doc__, "The current file position is unchanged. Returns the new size."); #define _IO_BYTESIO_TRUNCATE_METHODDEF \ - {"truncate", (PyCFunction)_io_BytesIO_truncate, METH_VARARGS, _io_BytesIO_truncate__doc__}, + {"truncate", (PyCFunction)_io_BytesIO_truncate, METH_FASTCALL, _io_BytesIO_truncate__doc__}, static PyObject * _io_BytesIO_truncate_impl(bytesio *self, PyObject *arg); static PyObject * -_io_BytesIO_truncate(bytesio *self, PyObject *args) +_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "truncate", + if (!_PyArg_UnpackStack(args, nargs, "truncate", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("truncate", kwnames)) { + goto exit; + } return_value = _io_BytesIO_truncate_impl(self, arg); exit: @@ -338,22 +378,26 @@ PyDoc_STRVAR(_io_BytesIO_seek__doc__, "Returns the new absolute position."); #define _IO_BYTESIO_SEEK_METHODDEF \ - {"seek", (PyCFunction)_io_BytesIO_seek, METH_VARARGS, _io_BytesIO_seek__doc__}, + {"seek", (PyCFunction)_io_BytesIO_seek, METH_FASTCALL, _io_BytesIO_seek__doc__}, static PyObject * _io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence); static PyObject * -_io_BytesIO_seek(bytesio *self, PyObject *args) +_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t pos; int whence = 0; - if (!PyArg_ParseTuple(args, "n|i:seek", + if (!_PyArg_ParseStack(args, nargs, "n|i:seek", &pos, &whence)) { goto exit; } + + if (!_PyArg_NoStackKeywords("seek", kwnames)) { + goto exit; + } return_value = _io_BytesIO_seek_impl(self, pos, whence); exit: @@ -428,4 +472,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=6382e8eb578eea64 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=138ee6ad6951bc84 input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h index 908fe0f8c8..7a8e2c64c3 100644 --- a/Modules/_io/clinic/fileio.c.h +++ b/Modules/_io/clinic/fileio.c.h @@ -202,21 +202,25 @@ PyDoc_STRVAR(_io_FileIO_read__doc__, "Return an empty bytes object at EOF."); #define _IO_FILEIO_READ_METHODDEF \ - {"read", (PyCFunction)_io_FileIO_read, METH_VARARGS, _io_FileIO_read__doc__}, + {"read", (PyCFunction)_io_FileIO_read, METH_FASTCALL, _io_FileIO_read__doc__}, static PyObject * _io_FileIO_read_impl(fileio *self, Py_ssize_t size); static PyObject * -_io_FileIO_read(fileio *self, PyObject *args) +_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!PyArg_ParseTuple(args, "|O&:read", + if (!_PyArg_ParseStack(args, nargs, "|O&:read", _PyIO_ConvertSsize_t, &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io_FileIO_read_impl(self, size); exit: @@ -274,22 +278,26 @@ PyDoc_STRVAR(_io_FileIO_seek__doc__, "Note that not all file objects are seekable."); #define _IO_FILEIO_SEEK_METHODDEF \ - {"seek", (PyCFunction)_io_FileIO_seek, METH_VARARGS, _io_FileIO_seek__doc__}, + {"seek", (PyCFunction)_io_FileIO_seek, METH_FASTCALL, _io_FileIO_seek__doc__}, static PyObject * _io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence); static PyObject * -_io_FileIO_seek(fileio *self, PyObject *args) +_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *pos; int whence = 0; - if (!PyArg_ParseTuple(args, "O|i:seek", + if (!_PyArg_ParseStack(args, nargs, "O|i:seek", &pos, &whence)) { goto exit; } + + if (!_PyArg_NoStackKeywords("seek", kwnames)) { + goto exit; + } return_value = _io_FileIO_seek_impl(self, pos, whence); exit: @@ -328,22 +336,26 @@ PyDoc_STRVAR(_io_FileIO_truncate__doc__, "The current file position is changed to the value of size."); #define _IO_FILEIO_TRUNCATE_METHODDEF \ - {"truncate", (PyCFunction)_io_FileIO_truncate, METH_VARARGS, _io_FileIO_truncate__doc__}, + {"truncate", (PyCFunction)_io_FileIO_truncate, METH_FASTCALL, _io_FileIO_truncate__doc__}, static PyObject * _io_FileIO_truncate_impl(fileio *self, PyObject *posobj); static PyObject * -_io_FileIO_truncate(fileio *self, PyObject *args) +_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *posobj = NULL; - if (!PyArg_UnpackTuple(args, "truncate", + if (!_PyArg_UnpackStack(args, nargs, "truncate", 0, 1, &posobj)) { goto exit; } + + if (!_PyArg_NoStackKeywords("truncate", kwnames)) { + goto exit; + } return_value = _io_FileIO_truncate_impl(self, posobj); exit: @@ -373,4 +385,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=51924bc0ee11d58e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=034d782a0daa82bd input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/iobase.c.h b/Modules/_io/clinic/iobase.c.h index edbf73a40b..045bb3b699 100644 --- a/Modules/_io/clinic/iobase.c.h +++ b/Modules/_io/clinic/iobase.c.h @@ -174,21 +174,25 @@ PyDoc_STRVAR(_io__IOBase_readline__doc__, "terminator(s) recognized."); #define _IO__IOBASE_READLINE_METHODDEF \ - {"readline", (PyCFunction)_io__IOBase_readline, METH_VARARGS, _io__IOBase_readline__doc__}, + {"readline", (PyCFunction)_io__IOBase_readline, METH_FASTCALL, _io__IOBase_readline__doc__}, static PyObject * _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit); static PyObject * -_io__IOBase_readline(PyObject *self, PyObject *args) +_io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t limit = -1; - if (!PyArg_ParseTuple(args, "|O&:readline", + if (!_PyArg_ParseStack(args, nargs, "|O&:readline", _PyIO_ConvertSsize_t, &limit)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readline", kwnames)) { + goto exit; + } return_value = _io__IOBase_readline_impl(self, limit); exit: @@ -206,21 +210,25 @@ PyDoc_STRVAR(_io__IOBase_readlines__doc__, "lines so far exceeds hint."); #define _IO__IOBASE_READLINES_METHODDEF \ - {"readlines", (PyCFunction)_io__IOBase_readlines, METH_VARARGS, _io__IOBase_readlines__doc__}, + {"readlines", (PyCFunction)_io__IOBase_readlines, METH_FASTCALL, _io__IOBase_readlines__doc__}, static PyObject * _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint); static PyObject * -_io__IOBase_readlines(PyObject *self, PyObject *args) +_io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t hint = -1; - if (!PyArg_ParseTuple(args, "|O&:readlines", + if (!_PyArg_ParseStack(args, nargs, "|O&:readlines", _PyIO_ConvertSsize_t, &hint)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readlines", kwnames)) { + goto exit; + } return_value = _io__IOBase_readlines_impl(self, hint); exit: @@ -241,21 +249,25 @@ PyDoc_STRVAR(_io__RawIOBase_read__doc__, "\n"); #define _IO__RAWIOBASE_READ_METHODDEF \ - {"read", (PyCFunction)_io__RawIOBase_read, METH_VARARGS, _io__RawIOBase_read__doc__}, + {"read", (PyCFunction)_io__RawIOBase_read, METH_FASTCALL, _io__RawIOBase_read__doc__}, static PyObject * _io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n); static PyObject * -_io__RawIOBase_read(PyObject *self, PyObject *args) +_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t n = -1; - if (!PyArg_ParseTuple(args, "|n:read", + if (!_PyArg_ParseStack(args, nargs, "|n:read", &n)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io__RawIOBase_read_impl(self, n); exit: @@ -279,4 +291,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _io__RawIOBase_readall_impl(self); } -/*[clinic end generated code: output=0f53fed928d8e02f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=1bcece367fc7b0cd input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h index d2c05d7cb1..af467d687f 100644 --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -48,22 +48,26 @@ PyDoc_STRVAR(_io_StringIO_read__doc__, "is reached. Return an empty string at EOF."); #define _IO_STRINGIO_READ_METHODDEF \ - {"read", (PyCFunction)_io_StringIO_read, METH_VARARGS, _io_StringIO_read__doc__}, + {"read", (PyCFunction)_io_StringIO_read, METH_FASTCALL, _io_StringIO_read__doc__}, static PyObject * _io_StringIO_read_impl(stringio *self, PyObject *arg); static PyObject * -_io_StringIO_read(stringio *self, PyObject *args) +_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "read", + if (!_PyArg_UnpackStack(args, nargs, "read", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io_StringIO_read_impl(self, arg); exit: @@ -79,22 +83,26 @@ PyDoc_STRVAR(_io_StringIO_readline__doc__, "Returns an empty string if EOF is hit immediately."); #define _IO_STRINGIO_READLINE_METHODDEF \ - {"readline", (PyCFunction)_io_StringIO_readline, METH_VARARGS, _io_StringIO_readline__doc__}, + {"readline", (PyCFunction)_io_StringIO_readline, METH_FASTCALL, _io_StringIO_readline__doc__}, static PyObject * _io_StringIO_readline_impl(stringio *self, PyObject *arg); static PyObject * -_io_StringIO_readline(stringio *self, PyObject *args) +_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "readline", + if (!_PyArg_UnpackStack(args, nargs, "readline", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readline", kwnames)) { + goto exit; + } return_value = _io_StringIO_readline_impl(self, arg); exit: @@ -112,22 +120,26 @@ PyDoc_STRVAR(_io_StringIO_truncate__doc__, "Returns the new absolute position."); #define _IO_STRINGIO_TRUNCATE_METHODDEF \ - {"truncate", (PyCFunction)_io_StringIO_truncate, METH_VARARGS, _io_StringIO_truncate__doc__}, + {"truncate", (PyCFunction)_io_StringIO_truncate, METH_FASTCALL, _io_StringIO_truncate__doc__}, static PyObject * _io_StringIO_truncate_impl(stringio *self, PyObject *arg); static PyObject * -_io_StringIO_truncate(stringio *self, PyObject *args) +_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!PyArg_UnpackTuple(args, "truncate", + if (!_PyArg_UnpackStack(args, nargs, "truncate", 0, 1, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("truncate", kwnames)) { + goto exit; + } return_value = _io_StringIO_truncate_impl(self, arg); exit: @@ -147,22 +159,26 @@ PyDoc_STRVAR(_io_StringIO_seek__doc__, "Returns the new absolute position."); #define _IO_STRINGIO_SEEK_METHODDEF \ - {"seek", (PyCFunction)_io_StringIO_seek, METH_VARARGS, _io_StringIO_seek__doc__}, + {"seek", (PyCFunction)_io_StringIO_seek, METH_FASTCALL, _io_StringIO_seek__doc__}, static PyObject * _io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence); static PyObject * -_io_StringIO_seek(stringio *self, PyObject *args) +_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t pos; int whence = 0; - if (!PyArg_ParseTuple(args, "n|i:seek", + if (!_PyArg_ParseStack(args, nargs, "n|i:seek", &pos, &whence)) { goto exit; } + + if (!_PyArg_NoStackKeywords("seek", kwnames)) { + goto exit; + } return_value = _io_StringIO_seek_impl(self, pos, whence); exit: @@ -289,4 +305,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=5dd5c2a213e75405 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ce8018ec29def422 input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h index f39c35581e..46b3edafa9 100644 --- a/Modules/_io/clinic/textio.c.h +++ b/Modules/_io/clinic/textio.c.h @@ -61,7 +61,7 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject **args, Py PyObject *input; int final = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &input, &final)) { goto exit; } @@ -225,21 +225,25 @@ PyDoc_STRVAR(_io_TextIOWrapper_read__doc__, "\n"); #define _IO_TEXTIOWRAPPER_READ_METHODDEF \ - {"read", (PyCFunction)_io_TextIOWrapper_read, METH_VARARGS, _io_TextIOWrapper_read__doc__}, + {"read", (PyCFunction)_io_TextIOWrapper_read, METH_FASTCALL, _io_TextIOWrapper_read__doc__}, static PyObject * _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n); static PyObject * -_io_TextIOWrapper_read(textio *self, PyObject *args) +_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t n = -1; - if (!PyArg_ParseTuple(args, "|O&:read", + if (!_PyArg_ParseStack(args, nargs, "|O&:read", _PyIO_ConvertSsize_t, &n)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io_TextIOWrapper_read_impl(self, n); exit: @@ -252,21 +256,25 @@ PyDoc_STRVAR(_io_TextIOWrapper_readline__doc__, "\n"); #define _IO_TEXTIOWRAPPER_READLINE_METHODDEF \ - {"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_VARARGS, _io_TextIOWrapper_readline__doc__}, + {"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_FASTCALL, _io_TextIOWrapper_readline__doc__}, static PyObject * _io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size); static PyObject * -_io_TextIOWrapper_readline(textio *self, PyObject *args) +_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!PyArg_ParseTuple(args, "|n:readline", + if (!_PyArg_ParseStack(args, nargs, "|n:readline", &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readline", kwnames)) { + goto exit; + } return_value = _io_TextIOWrapper_readline_impl(self, size); exit: @@ -279,22 +287,26 @@ PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__, "\n"); #define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \ - {"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_VARARGS, _io_TextIOWrapper_seek__doc__}, + {"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_FASTCALL, _io_TextIOWrapper_seek__doc__}, static PyObject * _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence); static PyObject * -_io_TextIOWrapper_seek(textio *self, PyObject *args) +_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *cookieObj; int whence = 0; - if (!PyArg_ParseTuple(args, "O|i:seek", + if (!_PyArg_ParseStack(args, nargs, "O|i:seek", &cookieObj, &whence)) { goto exit; } + + if (!_PyArg_NoStackKeywords("seek", kwnames)) { + goto exit; + } return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence); exit: @@ -324,22 +336,26 @@ PyDoc_STRVAR(_io_TextIOWrapper_truncate__doc__, "\n"); #define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF \ - {"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_VARARGS, _io_TextIOWrapper_truncate__doc__}, + {"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_FASTCALL, _io_TextIOWrapper_truncate__doc__}, static PyObject * _io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos); static PyObject * -_io_TextIOWrapper_truncate(textio *self, PyObject *args) +_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *pos = Py_None; - if (!PyArg_UnpackTuple(args, "truncate", + if (!_PyArg_UnpackStack(args, nargs, "truncate", 0, 1, &pos)) { goto exit; } + + if (!_PyArg_NoStackKeywords("truncate", kwnames)) { + goto exit; + } return_value = _io_TextIOWrapper_truncate_impl(self, pos); exit: @@ -464,4 +480,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored)) { return _io_TextIOWrapper_close_impl(self); } -/*[clinic end generated code: output=78ad14eba1667254 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=67eba50449900a96 input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/winconsoleio.c.h b/Modules/_io/clinic/winconsoleio.c.h index e44fcbb7a1..f568053d63 100644 --- a/Modules/_io/clinic/winconsoleio.c.h +++ b/Modules/_io/clinic/winconsoleio.c.h @@ -209,21 +209,25 @@ PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__, "Return an empty bytes object at EOF."); #define _IO__WINDOWSCONSOLEIO_READ_METHODDEF \ - {"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_VARARGS, _io__WindowsConsoleIO_read__doc__}, + {"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_FASTCALL, _io__WindowsConsoleIO_read__doc__}, static PyObject * _io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size); static PyObject * -_io__WindowsConsoleIO_read(winconsoleio *self, PyObject *args) +_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!PyArg_ParseTuple(args, "|O&:read", + if (!_PyArg_ParseStack(args, nargs, "|O&:read", _PyIO_ConvertSsize_t, &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _io__WindowsConsoleIO_read_impl(self, size); exit: @@ -328,4 +332,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=9eba916f8537fff7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=04dab03363f5e304 input=a9049054013a1b77]*/ |