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 | |
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')
-rw-r--r-- | Objects/clinic/bytearrayobject.c.h | 22 | ||||
-rw-r--r-- | Objects/clinic/bytesobject.c.h | 22 |
2 files changed, 26 insertions, 18 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]*/ diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h index 0cced8e..a99ce48 100644 --- a/Objects/clinic/bytesobject.c.h +++ b/Objects/clinic/bytesobject.c.h @@ -26,11 +26,12 @@ static PyObject * bytes_split(PyBytesObject *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; } @@ -144,11 +145,12 @@ static PyObject * bytes_rsplit(PyBytesObject *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; } @@ -429,11 +431,12 @@ static PyObject * bytes_decode(PyBytesObject *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; } @@ -462,10 +465,11 @@ static PyObject * bytes_splitlines(PyBytesObject *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; } @@ -504,4 +508,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=6fe884a74e7d49cf input=a9049054013a1b77]*/ +/*[clinic end generated code: output=637c2c14610d3c8d input=a9049054013a1b77]*/ |