From 7372e18fa83aa35766f8f6fdf3aed27fac2d52d2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 17 Jan 2017 01:35:17 +0100 Subject: Run Argument Clinic: METH_VARARGS=>METH_FASTCALL Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using only positional arguments. --- Modules/_io/clinic/stringio.c.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Modules/_io/clinic/stringio.c.h') diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h index d2c05d7cb1..e61720184b 100644 --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -147,22 +147,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 +293,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=69bf262268745061 input=a9049054013a1b77]*/ -- cgit v1.2.1 From 104cb4a3bacdf9764f9f8670a80da16390231337 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 17 Jan 2017 02:21:47 +0100 Subject: Run Argument Clinic: METH_VARARGS=>METH_FASTCALL Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using "boring" positional arguments. Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain consistent with the clinic code. --- Modules/_io/clinic/stringio.c.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'Modules/_io/clinic/stringio.c.h') diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h index e61720184b..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: @@ -293,4 +305,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=69bf262268745061 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ce8018ec29def422 input=a9049054013a1b77]*/ -- cgit v1.2.1