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/bytesio.c.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'Modules/_io/clinic/bytesio.c.h') diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h index 5f2abb03a7..1f736fed80 100644 --- a/Modules/_io/clinic/bytesio.c.h +++ b/Modules/_io/clinic/bytesio.c.h @@ -171,8 +171,9 @@ _io_BytesIO_read(bytesio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "read", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_read_impl(self, arg); exit: @@ -215,8 +216,9 @@ _io_BytesIO_readline(bytesio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "readline", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_readline_impl(self, arg); exit: @@ -247,8 +249,9 @@ _io_BytesIO_readlines(bytesio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "readlines", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_readlines_impl(self, arg); exit: @@ -276,14 +279,16 @@ _io_BytesIO_readinto(bytesio *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto", &buffer)) { goto exit; + } return_value = _io_BytesIO_readinto_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -311,8 +316,9 @@ _io_BytesIO_truncate(bytesio *self, PyObject *args) if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_truncate_impl(self, arg); exit: @@ -345,8 +351,9 @@ _io_BytesIO_seek(bytesio *self, PyObject *args) int whence = 0; if (!PyArg_ParseTuple(args, "n|i:seek", - &pos, &whence)) + &pos, &whence)) { goto exit; + } return_value = _io_BytesIO_seek_impl(self, pos, whence); exit: @@ -412,11 +419,12 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) PyObject *initvalue = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:BytesIO", _keywords, - &initvalue)) + &initvalue)) { goto exit; + } return_value = _io_BytesIO___init___impl((bytesio *)self, initvalue); exit: return return_value; } -/*[clinic end generated code: output=60ce2c6272718431 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3fdb62f3e3b0544d 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/bytesio.c.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Modules/_io/clinic/bytesio.c.h') diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h index 1f736fed80..c64ce5c77c 100644 --- a/Modules/_io/clinic/bytesio.c.h +++ b/Modules/_io/clinic/bytesio.c.h @@ -415,10 +415,11 @@ static int _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"initial_bytes", NULL}; + static const char * const _keywords[] = {"initial_bytes", NULL}; + static _PyArg_Parser _parser = {"|O:BytesIO", _keywords, 0}; PyObject *initvalue = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:BytesIO", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &initvalue)) { goto exit; } @@ -427,4 +428,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=3fdb62f3e3b0544d input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6382e8eb578eea64 input=a9049054013a1b77]*/ -- cgit v1.2.1