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