Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 PyDoc_STRVAR(_sre_getcodesize__doc__,
      6 "getcodesize($module, /)\n"
      7 "--\n"
      8 "\n");
      9 
     10 #define _SRE_GETCODESIZE_METHODDEF    \
     11     {"getcodesize", (PyCFunction)_sre_getcodesize, METH_NOARGS, _sre_getcodesize__doc__},
     12 
     13 static int
     14 _sre_getcodesize_impl(PyObject *module);
     15 
     16 static PyObject *
     17 _sre_getcodesize(PyObject *module, PyObject *Py_UNUSED(ignored))
     18 {
     19     PyObject *return_value = NULL;
     20     int _return_value;
     21 
     22     _return_value = _sre_getcodesize_impl(module);
     23     if ((_return_value == -1) && PyErr_Occurred()) {
     24         goto exit;
     25     }
     26     return_value = PyLong_FromLong((long)_return_value);
     27 
     28 exit:
     29     return return_value;
     30 }
     31 
     32 PyDoc_STRVAR(_sre_ascii_iscased__doc__,
     33 "ascii_iscased($module, character, /)\n"
     34 "--\n"
     35 "\n");
     36 
     37 #define _SRE_ASCII_ISCASED_METHODDEF    \
     38     {"ascii_iscased", (PyCFunction)_sre_ascii_iscased, METH_O, _sre_ascii_iscased__doc__},
     39 
     40 static int
     41 _sre_ascii_iscased_impl(PyObject *module, int character);
     42 
     43 static PyObject *
     44 _sre_ascii_iscased(PyObject *module, PyObject *arg)
     45 {
     46     PyObject *return_value = NULL;
     47     int character;
     48     int _return_value;
     49 
     50     if (!PyArg_Parse(arg, "i:ascii_iscased", &character)) {
     51         goto exit;
     52     }
     53     _return_value = _sre_ascii_iscased_impl(module, character);
     54     if ((_return_value == -1) && PyErr_Occurred()) {
     55         goto exit;
     56     }
     57     return_value = PyBool_FromLong((long)_return_value);
     58 
     59 exit:
     60     return return_value;
     61 }
     62 
     63 PyDoc_STRVAR(_sre_unicode_iscased__doc__,
     64 "unicode_iscased($module, character, /)\n"
     65 "--\n"
     66 "\n");
     67 
     68 #define _SRE_UNICODE_ISCASED_METHODDEF    \
     69     {"unicode_iscased", (PyCFunction)_sre_unicode_iscased, METH_O, _sre_unicode_iscased__doc__},
     70 
     71 static int
     72 _sre_unicode_iscased_impl(PyObject *module, int character);
     73 
     74 static PyObject *
     75 _sre_unicode_iscased(PyObject *module, PyObject *arg)
     76 {
     77     PyObject *return_value = NULL;
     78     int character;
     79     int _return_value;
     80 
     81     if (!PyArg_Parse(arg, "i:unicode_iscased", &character)) {
     82         goto exit;
     83     }
     84     _return_value = _sre_unicode_iscased_impl(module, character);
     85     if ((_return_value == -1) && PyErr_Occurred()) {
     86         goto exit;
     87     }
     88     return_value = PyBool_FromLong((long)_return_value);
     89 
     90 exit:
     91     return return_value;
     92 }
     93 
     94 PyDoc_STRVAR(_sre_ascii_tolower__doc__,
     95 "ascii_tolower($module, character, /)\n"
     96 "--\n"
     97 "\n");
     98 
     99 #define _SRE_ASCII_TOLOWER_METHODDEF    \
    100     {"ascii_tolower", (PyCFunction)_sre_ascii_tolower, METH_O, _sre_ascii_tolower__doc__},
    101 
    102 static int
    103 _sre_ascii_tolower_impl(PyObject *module, int character);
    104 
    105 static PyObject *
    106 _sre_ascii_tolower(PyObject *module, PyObject *arg)
    107 {
    108     PyObject *return_value = NULL;
    109     int character;
    110     int _return_value;
    111 
    112     if (!PyArg_Parse(arg, "i:ascii_tolower", &character)) {
    113         goto exit;
    114     }
    115     _return_value = _sre_ascii_tolower_impl(module, character);
    116     if ((_return_value == -1) && PyErr_Occurred()) {
    117         goto exit;
    118     }
    119     return_value = PyLong_FromLong((long)_return_value);
    120 
    121 exit:
    122     return return_value;
    123 }
    124 
    125 PyDoc_STRVAR(_sre_unicode_tolower__doc__,
    126 "unicode_tolower($module, character, /)\n"
    127 "--\n"
    128 "\n");
    129 
    130 #define _SRE_UNICODE_TOLOWER_METHODDEF    \
    131     {"unicode_tolower", (PyCFunction)_sre_unicode_tolower, METH_O, _sre_unicode_tolower__doc__},
    132 
    133 static int
    134 _sre_unicode_tolower_impl(PyObject *module, int character);
    135 
    136 static PyObject *
    137 _sre_unicode_tolower(PyObject *module, PyObject *arg)
    138 {
    139     PyObject *return_value = NULL;
    140     int character;
    141     int _return_value;
    142 
    143     if (!PyArg_Parse(arg, "i:unicode_tolower", &character)) {
    144         goto exit;
    145     }
    146     _return_value = _sre_unicode_tolower_impl(module, character);
    147     if ((_return_value == -1) && PyErr_Occurred()) {
    148         goto exit;
    149     }
    150     return_value = PyLong_FromLong((long)_return_value);
    151 
    152 exit:
    153     return return_value;
    154 }
    155 
    156 PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
    157 "match($self, /, string, pos=0, endpos=sys.maxsize)\n"
    158 "--\n"
    159 "\n"
    160 "Matches zero or more characters at the beginning of the string.");
    161 
    162 #define _SRE_SRE_PATTERN_MATCH_METHODDEF    \
    163     {"match", (PyCFunction)_sre_SRE_Pattern_match, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
    164 
    165 static PyObject *
    166 _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
    167                             Py_ssize_t pos, Py_ssize_t endpos);
    168 
    169 static PyObject *
    170 _sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    171 {
    172     PyObject *return_value = NULL;
    173     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
    174     static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0};
    175     PyObject *string;
    176     Py_ssize_t pos = 0;
    177     Py_ssize_t endpos = PY_SSIZE_T_MAX;
    178 
    179     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    180         &string, &pos, &endpos)) {
    181         goto exit;
    182     }
    183     return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos);
    184 
    185 exit:
    186     return return_value;
    187 }
    188 
    189 PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__,
    190 "fullmatch($self, /, string, pos=0, endpos=sys.maxsize)\n"
    191 "--\n"
    192 "\n"
    193 "Matches against all of the string.");
    194 
    195 #define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF    \
    196     {"fullmatch", (PyCFunction)_sre_SRE_Pattern_fullmatch, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
    197 
    198 static PyObject *
    199 _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
    200                                 Py_ssize_t pos, Py_ssize_t endpos);
    201 
    202 static PyObject *
    203 _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    204 {
    205     PyObject *return_value = NULL;
    206     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
    207     static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0};
    208     PyObject *string;
    209     Py_ssize_t pos = 0;
    210     Py_ssize_t endpos = PY_SSIZE_T_MAX;
    211 
    212     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    213         &string, &pos, &endpos)) {
    214         goto exit;
    215     }
    216     return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos);
    217 
    218 exit:
    219     return return_value;
    220 }
    221 
    222 PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
    223 "search($self, /, string, pos=0, endpos=sys.maxsize)\n"
    224 "--\n"
    225 "\n"
    226 "Scan through string looking for a match, and return a corresponding match object instance.\n"
    227 "\n"
    228 "Return None if no position in the string matches.");
    229 
    230 #define _SRE_SRE_PATTERN_SEARCH_METHODDEF    \
    231     {"search", (PyCFunction)_sre_SRE_Pattern_search, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
    232 
    233 static PyObject *
    234 _sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
    235                              Py_ssize_t pos, Py_ssize_t endpos);
    236 
    237 static PyObject *
    238 _sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    239 {
    240     PyObject *return_value = NULL;
    241     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
    242     static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0};
    243     PyObject *string;
    244     Py_ssize_t pos = 0;
    245     Py_ssize_t endpos = PY_SSIZE_T_MAX;
    246 
    247     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    248         &string, &pos, &endpos)) {
    249         goto exit;
    250     }
    251     return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos);
    252 
    253 exit:
    254     return return_value;
    255 }
    256 
    257 PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
    258 "findall($self, /, string, pos=0, endpos=sys.maxsize)\n"
    259 "--\n"
    260 "\n"
    261 "Return a list of all non-overlapping matches of pattern in string.");
    262 
    263 #define _SRE_SRE_PATTERN_FINDALL_METHODDEF    \
    264     {"findall", (PyCFunction)_sre_SRE_Pattern_findall, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__},
    265 
    266 static PyObject *
    267 _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
    268                               Py_ssize_t pos, Py_ssize_t endpos);
    269 
    270 static PyObject *
    271 _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    272 {
    273     PyObject *return_value = NULL;
    274     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
    275     static _PyArg_Parser _parser = {"O|nn:findall", _keywords, 0};
    276     PyObject *string;
    277     Py_ssize_t pos = 0;
    278     Py_ssize_t endpos = PY_SSIZE_T_MAX;
    279 
    280     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    281         &string, &pos, &endpos)) {
    282         goto exit;
    283     }
    284     return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos);
    285 
    286 exit:
    287     return return_value;
    288 }
    289 
    290 PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
    291 "finditer($self, /, string, pos=0, endpos=sys.maxsize)\n"
    292 "--\n"
    293 "\n"
    294 "Return an iterator over all non-overlapping matches for the RE pattern in string.\n"
    295 "\n"
    296 "For each match, the iterator returns a match object.");
    297 
    298 #define _SRE_SRE_PATTERN_FINDITER_METHODDEF    \
    299     {"finditer", (PyCFunction)_sre_SRE_Pattern_finditer, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
    300 
    301 static PyObject *
    302 _sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string,
    303                                Py_ssize_t pos, Py_ssize_t endpos);
    304 
    305 static PyObject *
    306 _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    307 {
    308     PyObject *return_value = NULL;
    309     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
    310     static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0};
    311     PyObject *string;
    312     Py_ssize_t pos = 0;
    313     Py_ssize_t endpos = PY_SSIZE_T_MAX;
    314 
    315     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    316         &string, &pos, &endpos)) {
    317         goto exit;
    318     }
    319     return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
    320 
    321 exit:
    322     return return_value;
    323 }
    324 
    325 PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
    326 "scanner($self, /, string, pos=0, endpos=sys.maxsize)\n"
    327 "--\n"
    328 "\n");
    329 
    330 #define _SRE_SRE_PATTERN_SCANNER_METHODDEF    \
    331     {"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
    332 
    333 static PyObject *
    334 _sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
    335                               Py_ssize_t pos, Py_ssize_t endpos);
    336 
    337 static PyObject *
    338 _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    339 {
    340     PyObject *return_value = NULL;
    341     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
    342     static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0};
    343     PyObject *string;
    344     Py_ssize_t pos = 0;
    345     Py_ssize_t endpos = PY_SSIZE_T_MAX;
    346 
    347     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    348         &string, &pos, &endpos)) {
    349         goto exit;
    350     }
    351     return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
    352 
    353 exit:
    354     return return_value;
    355 }
    356 
    357 PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
    358 "split($self, /, string, maxsplit=0)\n"
    359 "--\n"
    360 "\n"
    361 "Split string by the occurrences of pattern.");
    362 
    363 #define _SRE_SRE_PATTERN_SPLIT_METHODDEF    \
    364     {"split", (PyCFunction)_sre_SRE_Pattern_split, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__},
    365 
    366 static PyObject *
    367 _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
    368                             Py_ssize_t maxsplit);
    369 
    370 static PyObject *
    371 _sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    372 {
    373     PyObject *return_value = NULL;
    374     static const char * const _keywords[] = {"string", "maxsplit", NULL};
    375     static _PyArg_Parser _parser = {"O|n:split", _keywords, 0};
    376     PyObject *string;
    377     Py_ssize_t maxsplit = 0;
    378 
    379     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    380         &string, &maxsplit)) {
    381         goto exit;
    382     }
    383     return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit);
    384 
    385 exit:
    386     return return_value;
    387 }
    388 
    389 PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
    390 "sub($self, /, repl, string, count=0)\n"
    391 "--\n"
    392 "\n"
    393 "Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
    394 
    395 #define _SRE_SRE_PATTERN_SUB_METHODDEF    \
    396     {"sub", (PyCFunction)_sre_SRE_Pattern_sub, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
    397 
    398 static PyObject *
    399 _sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl,
    400                           PyObject *string, Py_ssize_t count);
    401 
    402 static PyObject *
    403 _sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    404 {
    405     PyObject *return_value = NULL;
    406     static const char * const _keywords[] = {"repl", "string", "count", NULL};
    407     static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0};
    408     PyObject *repl;
    409     PyObject *string;
    410     Py_ssize_t count = 0;
    411 
    412     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    413         &repl, &string, &count)) {
    414         goto exit;
    415     }
    416     return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
    417 
    418 exit:
    419     return return_value;
    420 }
    421 
    422 PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
    423 "subn($self, /, repl, string, count=0)\n"
    424 "--\n"
    425 "\n"
    426 "Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
    427 
    428 #define _SRE_SRE_PATTERN_SUBN_METHODDEF    \
    429     {"subn", (PyCFunction)_sre_SRE_Pattern_subn, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
    430 
    431 static PyObject *
    432 _sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl,
    433                            PyObject *string, Py_ssize_t count);
    434 
    435 static PyObject *
    436 _sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    437 {
    438     PyObject *return_value = NULL;
    439     static const char * const _keywords[] = {"repl", "string", "count", NULL};
    440     static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0};
    441     PyObject *repl;
    442     PyObject *string;
    443     Py_ssize_t count = 0;
    444 
    445     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    446         &repl, &string, &count)) {
    447         goto exit;
    448     }
    449     return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
    450 
    451 exit:
    452     return return_value;
    453 }
    454 
    455 PyDoc_STRVAR(_sre_SRE_Pattern___copy____doc__,
    456 "__copy__($self, /)\n"
    457 "--\n"
    458 "\n");
    459 
    460 #define _SRE_SRE_PATTERN___COPY___METHODDEF    \
    461     {"__copy__", (PyCFunction)_sre_SRE_Pattern___copy__, METH_NOARGS, _sre_SRE_Pattern___copy____doc__},
    462 
    463 static PyObject *
    464 _sre_SRE_Pattern___copy___impl(PatternObject *self);
    465 
    466 static PyObject *
    467 _sre_SRE_Pattern___copy__(PatternObject *self, PyObject *Py_UNUSED(ignored))
    468 {
    469     return _sre_SRE_Pattern___copy___impl(self);
    470 }
    471 
    472 PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
    473 "__deepcopy__($self, memo, /)\n"
    474 "--\n"
    475 "\n");
    476 
    477 #define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF    \
    478     {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_O, _sre_SRE_Pattern___deepcopy____doc__},
    479 
    480 PyDoc_STRVAR(_sre_compile__doc__,
    481 "compile($module, /, pattern, flags, code, groups, groupindex,\n"
    482 "        indexgroup)\n"
    483 "--\n"
    484 "\n");
    485 
    486 #define _SRE_COMPILE_METHODDEF    \
    487     {"compile", (PyCFunction)_sre_compile, METH_FASTCALL|METH_KEYWORDS, _sre_compile__doc__},
    488 
    489 static PyObject *
    490 _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
    491                   PyObject *code, Py_ssize_t groups, PyObject *groupindex,
    492                   PyObject *indexgroup);
    493 
    494 static PyObject *
    495 _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    496 {
    497     PyObject *return_value = NULL;
    498     static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
    499     static _PyArg_Parser _parser = {"OiO!nO!O!:compile", _keywords, 0};
    500     PyObject *pattern;
    501     int flags;
    502     PyObject *code;
    503     Py_ssize_t groups;
    504     PyObject *groupindex;
    505     PyObject *indexgroup;
    506 
    507     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    508         &pattern, &flags, &PyList_Type, &code, &groups, &PyDict_Type, &groupindex, &PyTuple_Type, &indexgroup)) {
    509         goto exit;
    510     }
    511     return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
    512 
    513 exit:
    514     return return_value;
    515 }
    516 
    517 PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
    518 "expand($self, /, template)\n"
    519 "--\n"
    520 "\n"
    521 "Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.");
    522 
    523 #define _SRE_SRE_MATCH_EXPAND_METHODDEF    \
    524     {"expand", (PyCFunction)_sre_SRE_Match_expand, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_expand__doc__},
    525 
    526 static PyObject *
    527 _sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template);
    528 
    529 static PyObject *
    530 _sre_SRE_Match_expand(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    531 {
    532     PyObject *return_value = NULL;
    533     static const char * const _keywords[] = {"template", NULL};
    534     static _PyArg_Parser _parser = {"O:expand", _keywords, 0};
    535     PyObject *template;
    536 
    537     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    538         &template)) {
    539         goto exit;
    540     }
    541     return_value = _sre_SRE_Match_expand_impl(self, template);
    542 
    543 exit:
    544     return return_value;
    545 }
    546 
    547 PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
    548 "groups($self, /, default=None)\n"
    549 "--\n"
    550 "\n"
    551 "Return a tuple containing all the subgroups of the match, from 1.\n"
    552 "\n"
    553 "  default\n"
    554 "    Is used for groups that did not participate in the match.");
    555 
    556 #define _SRE_SRE_MATCH_GROUPS_METHODDEF    \
    557     {"groups", (PyCFunction)_sre_SRE_Match_groups, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groups__doc__},
    558 
    559 static PyObject *
    560 _sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value);
    561 
    562 static PyObject *
    563 _sre_SRE_Match_groups(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    564 {
    565     PyObject *return_value = NULL;
    566     static const char * const _keywords[] = {"default", NULL};
    567     static _PyArg_Parser _parser = {"|O:groups", _keywords, 0};
    568     PyObject *default_value = Py_None;
    569 
    570     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    571         &default_value)) {
    572         goto exit;
    573     }
    574     return_value = _sre_SRE_Match_groups_impl(self, default_value);
    575 
    576 exit:
    577     return return_value;
    578 }
    579 
    580 PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
    581 "groupdict($self, /, default=None)\n"
    582 "--\n"
    583 "\n"
    584 "Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\n"
    585 "\n"
    586 "  default\n"
    587 "    Is used for groups that did not participate in the match.");
    588 
    589 #define _SRE_SRE_MATCH_GROUPDICT_METHODDEF    \
    590     {"groupdict", (PyCFunction)_sre_SRE_Match_groupdict, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__},
    591 
    592 static PyObject *
    593 _sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value);
    594 
    595 static PyObject *
    596 _sre_SRE_Match_groupdict(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    597 {
    598     PyObject *return_value = NULL;
    599     static const char * const _keywords[] = {"default", NULL};
    600     static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0};
    601     PyObject *default_value = Py_None;
    602 
    603     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
    604         &default_value)) {
    605         goto exit;
    606     }
    607     return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
    608 
    609 exit:
    610     return return_value;
    611 }
    612 
    613 PyDoc_STRVAR(_sre_SRE_Match_start__doc__,
    614 "start($self, group=0, /)\n"
    615 "--\n"
    616 "\n"
    617 "Return index of the start of the substring matched by group.");
    618 
    619 #define _SRE_SRE_MATCH_START_METHODDEF    \
    620     {"start", (PyCFunction)_sre_SRE_Match_start, METH_FASTCALL, _sre_SRE_Match_start__doc__},
    621 
    622 static Py_ssize_t
    623 _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
    624 
    625 static PyObject *
    626 _sre_SRE_Match_start(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
    627 {
    628     PyObject *return_value = NULL;
    629     PyObject *group = NULL;
    630     Py_ssize_t _return_value;
    631 
    632     if (!_PyArg_UnpackStack(args, nargs, "start",
    633         0, 1,
    634         &group)) {
    635         goto exit;
    636     }
    637     _return_value = _sre_SRE_Match_start_impl(self, group);
    638     if ((_return_value == -1) && PyErr_Occurred()) {
    639         goto exit;
    640     }
    641     return_value = PyLong_FromSsize_t(_return_value);
    642 
    643 exit:
    644     return return_value;
    645 }
    646 
    647 PyDoc_STRVAR(_sre_SRE_Match_end__doc__,
    648 "end($self, group=0, /)\n"
    649 "--\n"
    650 "\n"
    651 "Return index of the end of the substring matched by group.");
    652 
    653 #define _SRE_SRE_MATCH_END_METHODDEF    \
    654     {"end", (PyCFunction)_sre_SRE_Match_end, METH_FASTCALL, _sre_SRE_Match_end__doc__},
    655 
    656 static Py_ssize_t
    657 _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
    658 
    659 static PyObject *
    660 _sre_SRE_Match_end(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
    661 {
    662     PyObject *return_value = NULL;
    663     PyObject *group = NULL;
    664     Py_ssize_t _return_value;
    665 
    666     if (!_PyArg_UnpackStack(args, nargs, "end",
    667         0, 1,
    668         &group)) {
    669         goto exit;
    670     }
    671     _return_value = _sre_SRE_Match_end_impl(self, group);
    672     if ((_return_value == -1) && PyErr_Occurred()) {
    673         goto exit;
    674     }
    675     return_value = PyLong_FromSsize_t(_return_value);
    676 
    677 exit:
    678     return return_value;
    679 }
    680 
    681 PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
    682 "span($self, group=0, /)\n"
    683 "--\n"
    684 "\n"
    685 "For match object m, return the 2-tuple (m.start(group), m.end(group)).");
    686 
    687 #define _SRE_SRE_MATCH_SPAN_METHODDEF    \
    688     {"span", (PyCFunction)_sre_SRE_Match_span, METH_FASTCALL, _sre_SRE_Match_span__doc__},
    689 
    690 static PyObject *
    691 _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
    692 
    693 static PyObject *
    694 _sre_SRE_Match_span(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
    695 {
    696     PyObject *return_value = NULL;
    697     PyObject *group = NULL;
    698 
    699     if (!_PyArg_UnpackStack(args, nargs, "span",
    700         0, 1,
    701         &group)) {
    702         goto exit;
    703     }
    704     return_value = _sre_SRE_Match_span_impl(self, group);
    705 
    706 exit:
    707     return return_value;
    708 }
    709 
    710 PyDoc_STRVAR(_sre_SRE_Match___copy____doc__,
    711 "__copy__($self, /)\n"
    712 "--\n"
    713 "\n");
    714 
    715 #define _SRE_SRE_MATCH___COPY___METHODDEF    \
    716     {"__copy__", (PyCFunction)_sre_SRE_Match___copy__, METH_NOARGS, _sre_SRE_Match___copy____doc__},
    717 
    718 static PyObject *
    719 _sre_SRE_Match___copy___impl(MatchObject *self);
    720 
    721 static PyObject *
    722 _sre_SRE_Match___copy__(MatchObject *self, PyObject *Py_UNUSED(ignored))
    723 {
    724     return _sre_SRE_Match___copy___impl(self);
    725 }
    726 
    727 PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
    728 "__deepcopy__($self, memo, /)\n"
    729 "--\n"
    730 "\n");
    731 
    732 #define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF    \
    733     {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_O, _sre_SRE_Match___deepcopy____doc__},
    734 
    735 PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__,
    736 "match($self, /)\n"
    737 "--\n"
    738 "\n");
    739 
    740 #define _SRE_SRE_SCANNER_MATCH_METHODDEF    \
    741     {"match", (PyCFunction)_sre_SRE_Scanner_match, METH_NOARGS, _sre_SRE_Scanner_match__doc__},
    742 
    743 static PyObject *
    744 _sre_SRE_Scanner_match_impl(ScannerObject *self);
    745 
    746 static PyObject *
    747 _sre_SRE_Scanner_match(ScannerObject *self, PyObject *Py_UNUSED(ignored))
    748 {
    749     return _sre_SRE_Scanner_match_impl(self);
    750 }
    751 
    752 PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__,
    753 "search($self, /)\n"
    754 "--\n"
    755 "\n");
    756 
    757 #define _SRE_SRE_SCANNER_SEARCH_METHODDEF    \
    758     {"search", (PyCFunction)_sre_SRE_Scanner_search, METH_NOARGS, _sre_SRE_Scanner_search__doc__},
    759 
    760 static PyObject *
    761 _sre_SRE_Scanner_search_impl(ScannerObject *self);
    762 
    763 static PyObject *
    764 _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
    765 {
    766     return _sre_SRE_Scanner_search_impl(self);
    767 }
    768 /*[clinic end generated code: output=4b807104b65c1e0e input=a9049054013a1b77]*/
    769