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