diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-08-14 07:52:18 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-08-14 07:52:18 (GMT) |
commit | 9171a8b4cea3e7b30e4f2c0a989d7f7b8ffabe73 (patch) | |
tree | 5cc9c9243ba4ef93902fafdc624e56eab3b15842 /Objects/clinic/bytearrayobject.c.h | |
parent | b6f78c2755489dfcbe4898072ef0cd7dca11ff3d (diff) | |
download | cpython-9171a8b4cea3e7b30e4f2c0a989d7f7b8ffabe73.zip cpython-9171a8b4cea3e7b30e4f2c0a989d7f7b8ffabe73.tar.gz cpython-9171a8b4cea3e7b30e4f2c0a989d7f7b8ffabe73.tar.bz2 |
Issue #27574: Decreased an overhead of parsing keyword arguments in functions
implemented with using Argument Clinic.
Diffstat (limited to 'Objects/clinic/bytearrayobject.c.h')
-rw-r--r-- | Objects/clinic/bytearrayobject.c.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h index e1cf03b..b49c26b 100644 --- a/Objects/clinic/bytearrayobject.c.h +++ b/Objects/clinic/bytearrayobject.c.h @@ -200,11 +200,12 @@ static PyObject * bytearray_split(PyByteArrayObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"sep", "maxsplit", NULL}; + static const char * const _keywords[] = {"sep", "maxsplit", NULL}; + static _PyArg_Parser _parser = {"|On:split", _keywords, 0}; PyObject *sep = Py_None; Py_ssize_t maxsplit = -1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On:split", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &sep, &maxsplit)) { goto exit; } @@ -273,11 +274,12 @@ static PyObject * bytearray_rsplit(PyByteArrayObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"sep", "maxsplit", NULL}; + static const char * const _keywords[] = {"sep", "maxsplit", NULL}; + static _PyArg_Parser _parser = {"|On:rsplit", _keywords, 0}; PyObject *sep = Py_None; Py_ssize_t maxsplit = -1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On:rsplit", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &sep, &maxsplit)) { goto exit; } @@ -564,11 +566,12 @@ static PyObject * bytearray_decode(PyByteArrayObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"encoding", "errors", NULL}; + static const char * const _keywords[] = {"encoding", "errors", NULL}; + static _PyArg_Parser _parser = {"|ss:decode", _keywords, 0}; const char *encoding = NULL; const char *errors = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &encoding, &errors)) { goto exit; } @@ -610,10 +613,11 @@ static PyObject * bytearray_splitlines(PyByteArrayObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"keepends", NULL}; + static const char * const _keywords[] = {"keepends", NULL}; + static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0}; int keepends = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:splitlines", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &keepends)) { goto exit; } @@ -716,4 +720,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) { return bytearray_sizeof_impl(self); } -/*[clinic end generated code: output=a32f183ebef159cc input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0af30f8c0b1ecd76 input=a9049054013a1b77]*/ |