From a397e56d2aad76fe5cacd54a2ecbdb03702985c7 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 9 Jun 2016 16:16:06 +0300 Subject: Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7. --- Modules/_io/clinic/stringio.c.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 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 a8e32a3376..ce9f46e879 100644 --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -61,8 +61,9 @@ _io_StringIO_read(stringio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "read", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_StringIO_read_impl(self, arg); exit: @@ -91,8 +92,9 @@ _io_StringIO_readline(stringio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "readline", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_StringIO_readline_impl(self, arg); exit: @@ -123,8 +125,9 @@ _io_StringIO_truncate(stringio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_StringIO_truncate_impl(self, arg); exit: @@ -157,8 +160,9 @@ _io_StringIO_seek(stringio *self, PyObject *args) int whence = 0; if (!PyArg_ParseTuple(args, "n|i:seek", - &pos, &whence)) + &pos, &whence)) { goto exit; + } return_value = _io_StringIO_seek_impl(self, pos, whence); exit: @@ -222,8 +226,9 @@ _io_StringIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) PyObject *newline_obj = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:StringIO", _keywords, - &value, &newline_obj)) + &value, &newline_obj)) { goto exit; + } return_value = _io_StringIO___init___impl((stringio *)self, value, newline_obj); exit: @@ -283,4 +288,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=f061cf3a20cd14ed input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0513219581cbe952 input=a9049054013a1b77]*/ -- cgit v1.2.1 From 96d299b2b87dd2311bcc94cbab7b1cfa2c30ccba Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 14 Aug 2016 10:52:18 +0300 Subject: Issue #27574: Decreased an overhead of parsing keyword arguments in functions implemented with using Argument Clinic. --- Modules/_io/clinic/stringio.c.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 ce9f46e879..d2c05d7cb1 100644 --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -221,11 +221,12 @@ static int _io_StringIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"initial_value", "newline", NULL}; + static const char * const _keywords[] = {"initial_value", "newline", NULL}; + static _PyArg_Parser _parser = {"|OO:StringIO", _keywords, 0}; PyObject *value = NULL; PyObject *newline_obj = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:StringIO", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &value, &newline_obj)) { goto exit; } @@ -288,4 +289,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=0513219581cbe952 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5dd5c2a213e75405 input=a9049054013a1b77]*/ -- cgit v1.2.1