Issue #27574: Decreased an overhead of parsing keyword arguments in functions

implemented with using Argument Clinic.
This commit is contained in:
Serhiy Storchaka 2016-08-14 10:52:18 +03:00
parent b6f78c2755
commit 9171a8b4ce
36 changed files with 963 additions and 354 deletions

View file

@ -159,7 +159,8 @@ static PyObject *
builtin_compile(PyObject *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL};
static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL};
static _PyArg_Parser _parser = {"OO&s|iii:compile", _keywords, 0};
PyObject *source;
PyObject *filename;
const char *mode;
@ -167,7 +168,7 @@ builtin_compile(PyObject *module, PyObject *args, PyObject *kwargs)
int dont_inherit = 0;
int optimize = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO&s|iii:compile", _keywords,
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize)) {
goto exit;
}
@ -673,4 +674,4 @@ builtin_issubclass(PyObject *module, PyObject *args)
exit:
return return_value;
}
/*[clinic end generated code: output=6ab37e6c6d2e7b19 input=a9049054013a1b77]*/
/*[clinic end generated code: output=790cb3d26531dfda input=a9049054013a1b77]*/