diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-25 13:27:44 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-25 13:27:44 +0200 |
commit | 19b1c3b04e2b01bd3b35b9e14c1735959d3b65e8 (patch) | |
tree | 24ab2ab26f886e3da21f91979512412360abea5d /Modules/_io/clinic/fileio.c.h | |
parent | 3f19a274c28567afb39ba46ea8a2ebdeab816b0b (diff) | |
parent | 82e2d87e841850bc39db8ae954321986761492f5 (diff) | |
download | cpython-19b1c3b04e2b01bd3b35b9e14c1735959d3b65e8.tar.gz |
Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced with
a macro if Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher. Added functions
PySlice_Unpack() and PySlice_AdjustIndices().
Diffstat (limited to 'Modules/_io/clinic/fileio.c.h')
-rw-r--r-- | Modules/_io/clinic/fileio.c.h | 32 |
1 files changed, 22 insertions, 10 deletions
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]*/ |