diff options
Diffstat (limited to 'Modules/clinic/_sre.c.h')
-rw-r--r-- | Modules/clinic/_sre.c.h | 158 |
1 files changed, 81 insertions, 77 deletions
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h index 0612005d1e..fcb23e8919 100644 --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -35,23 +35,27 @@ PyDoc_STRVAR(_sre_getlower__doc__, "\n"); #define _SRE_GETLOWER_METHODDEF \ - {"getlower", (PyCFunction)_sre_getlower, METH_VARARGS, _sre_getlower__doc__}, + {"getlower", (PyCFunction)_sre_getlower, METH_FASTCALL, _sre_getlower__doc__}, static int _sre_getlower_impl(PyObject *module, int character, int flags); static PyObject * -_sre_getlower(PyObject *module, PyObject *args) +_sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int character; int flags; int _return_value; - if (!PyArg_ParseTuple(args, "ii:getlower", + if (!_PyArg_ParseStack(args, nargs, "ii:getlower", &character, &flags)) { goto exit; } + + if (!_PyArg_NoStackKeywords("getlower", kwnames)) { + goto exit; + } _return_value = _sre_getlower_impl(module, character, flags); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -63,7 +67,7 @@ exit: } PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__, -"match($self, /, string=None, pos=0, endpos=sys.maxsize, *, pattern=None)\n" +"match($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Matches zero or more characters at the beginning of the string."); @@ -73,33 +77,30 @@ PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__, static PyObject * _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *pattern); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_match(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:match", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *pattern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &pattern)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern); + return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos); exit: return return_value; } PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__, -"fullmatch($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" -" pattern=None)\n" +"fullmatch($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Matches against all of the string"); @@ -109,33 +110,30 @@ PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__, static PyObject * _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *pattern); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:fullmatch", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *pattern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &pattern)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern); + return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos); exit: return return_value; } PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__, -"search($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" -" pattern=None)\n" +"search($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Scan through string looking for a match, and return a corresponding match object instance.\n" @@ -147,33 +145,30 @@ PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__, static PyObject * _sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *pattern); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_search(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:search", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *pattern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &pattern)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern); + return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos); exit: return return_value; } PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__, -"findall($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" -" source=None)\n" +"findall($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Return a list of all non-overlapping matches of pattern in string."); @@ -183,25 +178,23 @@ PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__, static PyObject * _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *source); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_findall(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "source", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:findall", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:findall", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *source = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &source)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source); + return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos); exit: return return_value; @@ -232,7 +225,7 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject **args, Py_ssize_t nargs Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string, &pos, &endpos)) { goto exit; } @@ -264,7 +257,7 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject **args, Py_ssize_t nargs, Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string, &pos, &endpos)) { goto exit; } @@ -275,7 +268,7 @@ exit: } PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__, -"split($self, /, string=None, maxsplit=0, *, source=None)\n" +"split($self, /, string, maxsplit=0)\n" "--\n" "\n" "Split string by the occurrences of pattern."); @@ -285,23 +278,22 @@ PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__, static PyObject * _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string, - Py_ssize_t maxsplit, PyObject *source); + Py_ssize_t maxsplit); static PyObject * _sre_SRE_Pattern_split(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "maxsplit", "source", NULL}; - static _PyArg_Parser _parser = {"|On$O:split", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "maxsplit", NULL}; + static _PyArg_Parser _parser = {"O|n:split", _keywords, 0}; + PyObject *string; Py_ssize_t maxsplit = 0; - PyObject *source = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &maxsplit, &source)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &maxsplit)) { goto exit; } - return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source); + return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit); exit: return return_value; @@ -330,7 +322,7 @@ _sre_SRE_Pattern_sub(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyO PyObject *string; Py_ssize_t count = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &repl, &string, &count)) { goto exit; } @@ -363,7 +355,7 @@ _sre_SRE_Pattern_subn(PatternObject *self, PyObject **args, Py_ssize_t nargs, Py PyObject *string; Py_ssize_t count = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &repl, &string, &count)) { goto exit; } @@ -409,7 +401,7 @@ _sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject **args, Py_ssize_t n static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0}; PyObject *memo; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &memo)) { goto exit; } @@ -438,7 +430,7 @@ _sre_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna { PyObject *return_value = NULL; static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL}; - static _PyArg_Parser _parser = {"OiO!nOO:compile", _keywords, 0}; + static _PyArg_Parser _parser = {"OiO!nO!O!:compile", _keywords, 0}; PyObject *pattern; int flags; PyObject *code; @@ -446,8 +438,8 @@ _sre_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna PyObject *groupindex; PyObject *indexgroup; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &pattern, &flags, &PyList_Type, &code, &groups, &PyDict_Type, &groupindex, &PyTuple_Type, &indexgroup)) { goto exit; } return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup); @@ -476,7 +468,7 @@ _sre_SRE_Match_expand(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyOb static _PyArg_Parser _parser = {"O:expand", _keywords, 0}; PyObject *template; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &template)) { goto exit; } @@ -509,7 +501,7 @@ _sre_SRE_Match_groups(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyOb static _PyArg_Parser _parser = {"|O:groups", _keywords, 0}; PyObject *default_value = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &default_value)) { goto exit; } @@ -542,7 +534,7 @@ _sre_SRE_Match_groupdict(MatchObject *self, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0}; PyObject *default_value = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &default_value)) { goto exit; } @@ -559,23 +551,27 @@ PyDoc_STRVAR(_sre_SRE_Match_start__doc__, "Return index of the start of the substring matched by group."); #define _SRE_SRE_MATCH_START_METHODDEF \ - {"start", (PyCFunction)_sre_SRE_Match_start, METH_VARARGS, _sre_SRE_Match_start__doc__}, + {"start", (PyCFunction)_sre_SRE_Match_start, METH_FASTCALL, _sre_SRE_Match_start__doc__}, static Py_ssize_t _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_start(MatchObject *self, PyObject *args) +_sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; Py_ssize_t _return_value; - if (!PyArg_UnpackTuple(args, "start", + if (!_PyArg_UnpackStack(args, nargs, "start", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("start", kwnames)) { + goto exit; + } _return_value = _sre_SRE_Match_start_impl(self, group); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -593,23 +589,27 @@ PyDoc_STRVAR(_sre_SRE_Match_end__doc__, "Return index of the end of the substring matched by group."); #define _SRE_SRE_MATCH_END_METHODDEF \ - {"end", (PyCFunction)_sre_SRE_Match_end, METH_VARARGS, _sre_SRE_Match_end__doc__}, + {"end", (PyCFunction)_sre_SRE_Match_end, METH_FASTCALL, _sre_SRE_Match_end__doc__}, static Py_ssize_t _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_end(MatchObject *self, PyObject *args) +_sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; Py_ssize_t _return_value; - if (!PyArg_UnpackTuple(args, "end", + if (!_PyArg_UnpackStack(args, nargs, "end", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("end", kwnames)) { + goto exit; + } _return_value = _sre_SRE_Match_end_impl(self, group); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -627,22 +627,26 @@ PyDoc_STRVAR(_sre_SRE_Match_span__doc__, "For MatchObject m, return the 2-tuple (m.start(group), m.end(group))."); #define _SRE_SRE_MATCH_SPAN_METHODDEF \ - {"span", (PyCFunction)_sre_SRE_Match_span, METH_VARARGS, _sre_SRE_Match_span__doc__}, + {"span", (PyCFunction)_sre_SRE_Match_span, METH_FASTCALL, _sre_SRE_Match_span__doc__}, static PyObject * _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_span(MatchObject *self, PyObject *args) +_sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; - if (!PyArg_UnpackTuple(args, "span", + if (!_PyArg_UnpackStack(args, nargs, "span", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("span", kwnames)) { + goto exit; + } return_value = _sre_SRE_Match_span_impl(self, group); exit: @@ -685,7 +689,7 @@ _sre_SRE_Match___deepcopy__(MatchObject *self, PyObject **args, Py_ssize_t nargs static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0}; PyObject *memo; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &memo)) { goto exit; } @@ -728,4 +732,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) { return _sre_SRE_Scanner_search_impl(self); } -/*[clinic end generated code: output=a4a246bca1963bc9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5df18da8e2dc762c input=a9049054013a1b77]*/ |