Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Modules/clinic/_sre.c.h
Line
Count
Source (jump to first uncovered line)
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
0
{
19
0
    PyObject *return_value = NULL;
20
0
    int _return_value;
21
22
0
    _return_value = _sre_getcodesize_impl(module);
23
0
    if ((_return_value == -1) && PyErr_Occurred()) {
24
0
        goto exit;
25
0
    }
26
0
    return_value = PyLong_FromLong((long)_return_value);
27
28
0
exit:
29
0
    return return_value;
30
0
}
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
8
{
46
8
    PyObject *return_value = NULL;
47
8
    int character;
48
8
    int _return_value;
49
50
8
    if (PyFloat_Check(arg)) {
51
0
        PyErr_SetString(PyExc_TypeError,
52
0
                        "integer argument expected, got float" );
53
0
        goto exit;
54
0
    }
55
8
    character = _PyLong_AsInt(arg);
56
8
    if (character == -1 && PyErr_Occurred()) {
57
0
        goto exit;
58
0
    }
59
8
    _return_value = _sre_ascii_iscased_impl(module, character);
60
8
    if ((_return_value == -1) && PyErr_Occurred()) {
61
0
        goto exit;
62
0
    }
63
8
    return_value = PyBool_FromLong((long)_return_value);
64
65
8
exit:
66
8
    return return_value;
67
8
}
68
69
PyDoc_STRVAR(_sre_unicode_iscased__doc__,
70
"unicode_iscased($module, character, /)\n"
71
"--\n"
72
"\n");
73
74
#define _SRE_UNICODE_ISCASED_METHODDEF    \
75
    {"unicode_iscased", (PyCFunction)_sre_unicode_iscased, METH_O, _sre_unicode_iscased__doc__},
76
77
static int
78
_sre_unicode_iscased_impl(PyObject *module, int character);
79
80
static PyObject *
81
_sre_unicode_iscased(PyObject *module, PyObject *arg)
82
36
{
83
36
    PyObject *return_value = NULL;
84
36
    int character;
85
36
    int _return_value;
86
87
36
    if (PyFloat_Check(arg)) {
88
0
        PyErr_SetString(PyExc_TypeError,
89
0
                        "integer argument expected, got float" );
90
0
        goto exit;
91
0
    }
92
36
    character = _PyLong_AsInt(arg);
93
36
    if (character == -1 && PyErr_Occurred()) {
94
0
        goto exit;
95
0
    }
96
36
    _return_value = _sre_unicode_iscased_impl(module, character);
97
36
    if ((_return_value == -1) && PyErr_Occurred()) {
98
0
        goto exit;
99
0
    }
100
36
    return_value = PyBool_FromLong((long)_return_value);
101
102
36
exit:
103
36
    return return_value;
104
36
}
105
106
PyDoc_STRVAR(_sre_ascii_tolower__doc__,
107
"ascii_tolower($module, character, /)\n"
108
"--\n"
109
"\n");
110
111
#define _SRE_ASCII_TOLOWER_METHODDEF    \
112
    {"ascii_tolower", (PyCFunction)_sre_ascii_tolower, METH_O, _sre_ascii_tolower__doc__},
113
114
static int
115
_sre_ascii_tolower_impl(PyObject *module, int character);
116
117
static PyObject *
118
_sre_ascii_tolower(PyObject *module, PyObject *arg)
119
128
{
120
128
    PyObject *return_value = NULL;
121
128
    int character;
122
128
    int _return_value;
123
124
128
    if (PyFloat_Check(arg)) {
125
0
        PyErr_SetString(PyExc_TypeError,
126
0
                        "integer argument expected, got float" );
127
0
        goto exit;
128
0
    }
129
128
    character = _PyLong_AsInt(arg);
130
128
    if (character == -1 && PyErr_Occurred()) {
131
0
        goto exit;
132
0
    }
133
128
    _return_value = _sre_ascii_tolower_impl(module, character);
134
128
    if ((_return_value == -1) && PyErr_Occurred()) {
135
0
        goto exit;
136
0
    }
137
128
    return_value = PyLong_FromLong((long)_return_value);
138
139
128
exit:
140
128
    return return_value;
141
128
}
142
143
PyDoc_STRVAR(_sre_unicode_tolower__doc__,
144
"unicode_tolower($module, character, /)\n"
145
"--\n"
146
"\n");
147
148
#define _SRE_UNICODE_TOLOWER_METHODDEF    \
149
    {"unicode_tolower", (PyCFunction)_sre_unicode_tolower, METH_O, _sre_unicode_tolower__doc__},
150
151
static int
152
_sre_unicode_tolower_impl(PyObject *module, int character);
153
154
static PyObject *
155
_sre_unicode_tolower(PyObject *module, PyObject *arg)
156
40
{
157
40
    PyObject *return_value = NULL;
158
40
    int character;
159
40
    int _return_value;
160
161
40
    if (PyFloat_Check(arg)) {
162
0
        PyErr_SetString(PyExc_TypeError,
163
0
                        "integer argument expected, got float" );
164
0
        goto exit;
165
0
    }
166
40
    character = _PyLong_AsInt(arg);
167
40
    if (character == -1 && PyErr_Occurred()) {
168
0
        goto exit;
169
0
    }
170
40
    _return_value = _sre_unicode_tolower_impl(module, character);
171
40
    if ((_return_value == -1) && PyErr_Occurred()) {
172
0
        goto exit;
173
0
    }
174
40
    return_value = PyLong_FromLong((long)_return_value);
175
176
40
exit:
177
40
    return return_value;
178
40
}
179
180
PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
181
"match($self, /, string, pos=0, endpos=sys.maxsize)\n"
182
"--\n"
183
"\n"
184
"Matches zero or more characters at the beginning of the string.");
185
186
#define _SRE_SRE_PATTERN_MATCH_METHODDEF    \
187
    {"match", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_match, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
188
189
static PyObject *
190
_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
191
                            Py_ssize_t pos, Py_ssize_t endpos);
192
193
static PyObject *
194
_sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
195
4
{
196
4
    PyObject *return_value = NULL;
197
4
    static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
198
4
    static _PyArg_Parser _parser = {NULL, _keywords, "match", 0};
199
4
    PyObject *argsbuf[3];
200
4
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
201
4
    PyObject *string;
202
4
    Py_ssize_t pos = 0;
203
4
    Py_ssize_t endpos = PY_SSIZE_T_MAX;
204
205
4
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
206
4
    if (!args) {
207
0
        goto exit;
208
0
    }
209
4
    string = args[0];
210
4
    if (!noptargs) {
211
4
        goto skip_optional_pos;
212
4
    }
213
0
    if (args[1]) {
214
0
        if (PyFloat_Check(args[1])) {
215
0
            PyErr_SetString(PyExc_TypeError,
216
0
                            "integer argument expected, got float" );
217
0
            goto exit;
218
0
        }
219
0
        {
220
0
            Py_ssize_t ival = -1;
221
0
            PyObject *iobj = PyNumber_Index(args[1]);
222
0
            if (iobj != NULL) {
223
0
                ival = PyLong_AsSsize_t(iobj);
224
0
                Py_DECREF(iobj);
225
0
            }
226
0
            if (ival == -1 && PyErr_Occurred()) {
227
0
                goto exit;
228
0
            }
229
0
            pos = ival;
230
0
        }
231
0
        if (!--noptargs) {
232
0
            goto skip_optional_pos;
233
0
        }
234
0
    }
235
0
    if (PyFloat_Check(args[2])) {
236
0
        PyErr_SetString(PyExc_TypeError,
237
0
                        "integer argument expected, got float" );
238
0
        goto exit;
239
0
    }
240
0
    {
241
0
        Py_ssize_t ival = -1;
242
0
        PyObject *iobj = PyNumber_Index(args[2]);
243
0
        if (iobj != NULL) {
244
0
            ival = PyLong_AsSsize_t(iobj);
245
0
            Py_DECREF(iobj);
246
0
        }
247
0
        if (ival == -1 && PyErr_Occurred()) {
248
0
            goto exit;
249
0
        }
250
0
        endpos = ival;
251
0
    }
252
4
skip_optional_pos:
253
4
    return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos);
254
255
4
exit:
256
4
    return return_value;
257
4
}
258
259
PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__,
260
"fullmatch($self, /, string, pos=0, endpos=sys.maxsize)\n"
261
"--\n"
262
"\n"
263
"Matches against all of the string.");
264
265
#define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF    \
266
    {"fullmatch", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_fullmatch, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
267
268
static PyObject *
269
_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
270
                                Py_ssize_t pos, Py_ssize_t endpos);
271
272
static PyObject *
273
_sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
274
0
{
275
0
    PyObject *return_value = NULL;
276
0
    static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
277
0
    static _PyArg_Parser _parser = {NULL, _keywords, "fullmatch", 0};
278
0
    PyObject *argsbuf[3];
279
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
280
0
    PyObject *string;
281
0
    Py_ssize_t pos = 0;
282
0
    Py_ssize_t endpos = PY_SSIZE_T_MAX;
283
284
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
285
0
    if (!args) {
286
0
        goto exit;
287
0
    }
288
0
    string = args[0];
289
0
    if (!noptargs) {
290
0
        goto skip_optional_pos;
291
0
    }
292
0
    if (args[1]) {
293
0
        if (PyFloat_Check(args[1])) {
294
0
            PyErr_SetString(PyExc_TypeError,
295
0
                            "integer argument expected, got float" );
296
0
            goto exit;
297
0
        }
298
0
        {
299
0
            Py_ssize_t ival = -1;
300
0
            PyObject *iobj = PyNumber_Index(args[1]);
301
0
            if (iobj != NULL) {
302
0
                ival = PyLong_AsSsize_t(iobj);
303
0
                Py_DECREF(iobj);
304
0
            }
305
0
            if (ival == -1 && PyErr_Occurred()) {
306
0
                goto exit;
307
0
            }
308
0
            pos = ival;
309
0
        }
310
0
        if (!--noptargs) {
311
0
            goto skip_optional_pos;
312
0
        }
313
0
    }
314
0
    if (PyFloat_Check(args[2])) {
315
0
        PyErr_SetString(PyExc_TypeError,
316
0
                        "integer argument expected, got float" );
317
0
        goto exit;
318
0
    }
319
0
    {
320
0
        Py_ssize_t ival = -1;
321
0
        PyObject *iobj = PyNumber_Index(args[2]);
322
0
        if (iobj != NULL) {
323
0
            ival = PyLong_AsSsize_t(iobj);
324
0
            Py_DECREF(iobj);
325
0
        }
326
0
        if (ival == -1 && PyErr_Occurred()) {
327
0
            goto exit;
328
0
        }
329
0
        endpos = ival;
330
0
    }
331
0
skip_optional_pos:
332
0
    return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos);
333
334
0
exit:
335
0
    return return_value;
336
0
}
337
338
PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
339
"search($self, /, string, pos=0, endpos=sys.maxsize)\n"
340
"--\n"
341
"\n"
342
"Scan through string looking for a match, and return a corresponding match object instance.\n"
343
"\n"
344
"Return None if no position in the string matches.");
345
346
#define _SRE_SRE_PATTERN_SEARCH_METHODDEF    \
347
    {"search", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_search, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
348
349
static PyObject *
350
_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
351
                             Py_ssize_t pos, Py_ssize_t endpos);
352
353
static PyObject *
354
_sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
355
2
{
356
2
    PyObject *return_value = NULL;
357
2
    static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
358
2
    static _PyArg_Parser _parser = {NULL, _keywords, "search", 0};
359
2
    PyObject *argsbuf[3];
360
2
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
361
2
    PyObject *string;
362
2
    Py_ssize_t pos = 0;
363
2
    Py_ssize_t endpos = PY_SSIZE_T_MAX;
364
365
2
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
366
2
    if (!args) {
367
0
        goto exit;
368
0
    }
369
2
    string = args[0];
370
2
    if (!noptargs) {
371
2
        goto skip_optional_pos;
372
2
    }
373
0
    if (args[1]) {
374
0
        if (PyFloat_Check(args[1])) {
375
0
            PyErr_SetString(PyExc_TypeError,
376
0
                            "integer argument expected, got float" );
377
0
            goto exit;
378
0
        }
379
0
        {
380
0
            Py_ssize_t ival = -1;
381
0
            PyObject *iobj = PyNumber_Index(args[1]);
382
0
            if (iobj != NULL) {
383
0
                ival = PyLong_AsSsize_t(iobj);
384
0
                Py_DECREF(iobj);
385
0
            }
386
0
            if (ival == -1 && PyErr_Occurred()) {
387
0
                goto exit;
388
0
            }
389
0
            pos = ival;
390
0
        }
391
0
        if (!--noptargs) {
392
0
            goto skip_optional_pos;
393
0
        }
394
0
    }
395
0
    if (PyFloat_Check(args[2])) {
396
0
        PyErr_SetString(PyExc_TypeError,
397
0
                        "integer argument expected, got float" );
398
0
        goto exit;
399
0
    }
400
0
    {
401
0
        Py_ssize_t ival = -1;
402
0
        PyObject *iobj = PyNumber_Index(args[2]);
403
0
        if (iobj != NULL) {
404
0
            ival = PyLong_AsSsize_t(iobj);
405
0
            Py_DECREF(iobj);
406
0
        }
407
0
        if (ival == -1 && PyErr_Occurred()) {
408
0
            goto exit;
409
0
        }
410
0
        endpos = ival;
411
0
    }
412
2
skip_optional_pos:
413
2
    return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos);
414
415
2
exit:
416
2
    return return_value;
417
2
}
418
419
PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
420
"findall($self, /, string, pos=0, endpos=sys.maxsize)\n"
421
"--\n"
422
"\n"
423
"Return a list of all non-overlapping matches of pattern in string.");
424
425
#define _SRE_SRE_PATTERN_FINDALL_METHODDEF    \
426
    {"findall", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_findall, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__},
427
428
static PyObject *
429
_sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
430
                              Py_ssize_t pos, Py_ssize_t endpos);
431
432
static PyObject *
433
_sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
434
0
{
435
0
    PyObject *return_value = NULL;
436
0
    static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
437
0
    static _PyArg_Parser _parser = {NULL, _keywords, "findall", 0};
438
0
    PyObject *argsbuf[3];
439
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
440
0
    PyObject *string;
441
0
    Py_ssize_t pos = 0;
442
0
    Py_ssize_t endpos = PY_SSIZE_T_MAX;
443
444
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
445
0
    if (!args) {
446
0
        goto exit;
447
0
    }
448
0
    string = args[0];
449
0
    if (!noptargs) {
450
0
        goto skip_optional_pos;
451
0
    }
452
0
    if (args[1]) {
453
0
        if (PyFloat_Check(args[1])) {
454
0
            PyErr_SetString(PyExc_TypeError,
455
0
                            "integer argument expected, got float" );
456
0
            goto exit;
457
0
        }
458
0
        {
459
0
            Py_ssize_t ival = -1;
460
0
            PyObject *iobj = PyNumber_Index(args[1]);
461
0
            if (iobj != NULL) {
462
0
                ival = PyLong_AsSsize_t(iobj);
463
0
                Py_DECREF(iobj);
464
0
            }
465
0
            if (ival == -1 && PyErr_Occurred()) {
466
0
                goto exit;
467
0
            }
468
0
            pos = ival;
469
0
        }
470
0
        if (!--noptargs) {
471
0
            goto skip_optional_pos;
472
0
        }
473
0
    }
474
0
    if (PyFloat_Check(args[2])) {
475
0
        PyErr_SetString(PyExc_TypeError,
476
0
                        "integer argument expected, got float" );
477
0
        goto exit;
478
0
    }
479
0
    {
480
0
        Py_ssize_t ival = -1;
481
0
        PyObject *iobj = PyNumber_Index(args[2]);
482
0
        if (iobj != NULL) {
483
0
            ival = PyLong_AsSsize_t(iobj);
484
0
            Py_DECREF(iobj);
485
0
        }
486
0
        if (ival == -1 && PyErr_Occurred()) {
487
0
            goto exit;
488
0
        }
489
0
        endpos = ival;
490
0
    }
491
0
skip_optional_pos:
492
0
    return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos);
493
494
0
exit:
495
0
    return return_value;
496
0
}
497
498
PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
499
"finditer($self, /, string, pos=0, endpos=sys.maxsize)\n"
500
"--\n"
501
"\n"
502
"Return an iterator over all non-overlapping matches for the RE pattern in string.\n"
503
"\n"
504
"For each match, the iterator returns a match object.");
505
506
#define _SRE_SRE_PATTERN_FINDITER_METHODDEF    \
507
    {"finditer", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_finditer, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
508
509
static PyObject *
510
_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string,
511
                               Py_ssize_t pos, Py_ssize_t endpos);
512
513
static PyObject *
514
_sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
515
0
{
516
0
    PyObject *return_value = NULL;
517
0
    static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
518
0
    static _PyArg_Parser _parser = {NULL, _keywords, "finditer", 0};
519
0
    PyObject *argsbuf[3];
520
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
521
0
    PyObject *string;
522
0
    Py_ssize_t pos = 0;
523
0
    Py_ssize_t endpos = PY_SSIZE_T_MAX;
524
525
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
526
0
    if (!args) {
527
0
        goto exit;
528
0
    }
529
0
    string = args[0];
530
0
    if (!noptargs) {
531
0
        goto skip_optional_pos;
532
0
    }
533
0
    if (args[1]) {
534
0
        if (PyFloat_Check(args[1])) {
535
0
            PyErr_SetString(PyExc_TypeError,
536
0
                            "integer argument expected, got float" );
537
0
            goto exit;
538
0
        }
539
0
        {
540
0
            Py_ssize_t ival = -1;
541
0
            PyObject *iobj = PyNumber_Index(args[1]);
542
0
            if (iobj != NULL) {
543
0
                ival = PyLong_AsSsize_t(iobj);
544
0
                Py_DECREF(iobj);
545
0
            }
546
0
            if (ival == -1 && PyErr_Occurred()) {
547
0
                goto exit;
548
0
            }
549
0
            pos = ival;
550
0
        }
551
0
        if (!--noptargs) {
552
0
            goto skip_optional_pos;
553
0
        }
554
0
    }
555
0
    if (PyFloat_Check(args[2])) {
556
0
        PyErr_SetString(PyExc_TypeError,
557
0
                        "integer argument expected, got float" );
558
0
        goto exit;
559
0
    }
560
0
    {
561
0
        Py_ssize_t ival = -1;
562
0
        PyObject *iobj = PyNumber_Index(args[2]);
563
0
        if (iobj != NULL) {
564
0
            ival = PyLong_AsSsize_t(iobj);
565
0
            Py_DECREF(iobj);
566
0
        }
567
0
        if (ival == -1 && PyErr_Occurred()) {
568
0
            goto exit;
569
0
        }
570
0
        endpos = ival;
571
0
    }
572
0
skip_optional_pos:
573
0
    return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
574
575
0
exit:
576
0
    return return_value;
577
0
}
578
579
PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
580
"scanner($self, /, string, pos=0, endpos=sys.maxsize)\n"
581
"--\n"
582
"\n");
583
584
#define _SRE_SRE_PATTERN_SCANNER_METHODDEF    \
585
    {"scanner", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_scanner, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
586
587
static PyObject *
588
_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
589
                              Py_ssize_t pos, Py_ssize_t endpos);
590
591
static PyObject *
592
_sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
593
0
{
594
0
    PyObject *return_value = NULL;
595
0
    static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
596
0
    static _PyArg_Parser _parser = {NULL, _keywords, "scanner", 0};
597
0
    PyObject *argsbuf[3];
598
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
599
0
    PyObject *string;
600
0
    Py_ssize_t pos = 0;
601
0
    Py_ssize_t endpos = PY_SSIZE_T_MAX;
602
603
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
604
0
    if (!args) {
605
0
        goto exit;
606
0
    }
607
0
    string = args[0];
608
0
    if (!noptargs) {
609
0
        goto skip_optional_pos;
610
0
    }
611
0
    if (args[1]) {
612
0
        if (PyFloat_Check(args[1])) {
613
0
            PyErr_SetString(PyExc_TypeError,
614
0
                            "integer argument expected, got float" );
615
0
            goto exit;
616
0
        }
617
0
        {
618
0
            Py_ssize_t ival = -1;
619
0
            PyObject *iobj = PyNumber_Index(args[1]);
620
0
            if (iobj != NULL) {
621
0
                ival = PyLong_AsSsize_t(iobj);
622
0
                Py_DECREF(iobj);
623
0
            }
624
0
            if (ival == -1 && PyErr_Occurred()) {
625
0
                goto exit;
626
0
            }
627
0
            pos = ival;
628
0
        }
629
0
        if (!--noptargs) {
630
0
            goto skip_optional_pos;
631
0
        }
632
0
    }
633
0
    if (PyFloat_Check(args[2])) {
634
0
        PyErr_SetString(PyExc_TypeError,
635
0
                        "integer argument expected, got float" );
636
0
        goto exit;
637
0
    }
638
0
    {
639
0
        Py_ssize_t ival = -1;
640
0
        PyObject *iobj = PyNumber_Index(args[2]);
641
0
        if (iobj != NULL) {
642
0
            ival = PyLong_AsSsize_t(iobj);
643
0
            Py_DECREF(iobj);
644
0
        }
645
0
        if (ival == -1 && PyErr_Occurred()) {
646
0
            goto exit;
647
0
        }
648
0
        endpos = ival;
649
0
    }
650
0
skip_optional_pos:
651
0
    return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
652
653
0
exit:
654
0
    return return_value;
655
0
}
656
657
PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
658
"split($self, /, string, maxsplit=0)\n"
659
"--\n"
660
"\n"
661
"Split string by the occurrences of pattern.");
662
663
#define _SRE_SRE_PATTERN_SPLIT_METHODDEF    \
664
    {"split", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_split, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__},
665
666
static PyObject *
667
_sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
668
                            Py_ssize_t maxsplit);
669
670
static PyObject *
671
_sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
672
0
{
673
0
    PyObject *return_value = NULL;
674
0
    static const char * const _keywords[] = {"string", "maxsplit", NULL};
675
0
    static _PyArg_Parser _parser = {NULL, _keywords, "split", 0};
676
0
    PyObject *argsbuf[2];
677
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
678
0
    PyObject *string;
679
0
    Py_ssize_t maxsplit = 0;
680
681
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
682
0
    if (!args) {
683
0
        goto exit;
684
0
    }
685
0
    string = args[0];
686
0
    if (!noptargs) {
687
0
        goto skip_optional_pos;
688
0
    }
689
0
    if (PyFloat_Check(args[1])) {
690
0
        PyErr_SetString(PyExc_TypeError,
691
0
                        "integer argument expected, got float" );
692
0
        goto exit;
693
0
    }
694
0
    {
695
0
        Py_ssize_t ival = -1;
696
0
        PyObject *iobj = PyNumber_Index(args[1]);
697
0
        if (iobj != NULL) {
698
0
            ival = PyLong_AsSsize_t(iobj);
699
0
            Py_DECREF(iobj);
700
0
        }
701
0
        if (ival == -1 && PyErr_Occurred()) {
702
0
            goto exit;
703
0
        }
704
0
        maxsplit = ival;
705
0
    }
706
0
skip_optional_pos:
707
0
    return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit);
708
709
0
exit:
710
0
    return return_value;
711
0
}
712
713
PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
714
"sub($self, /, repl, string, count=0)\n"
715
"--\n"
716
"\n"
717
"Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
718
719
#define _SRE_SRE_PATTERN_SUB_METHODDEF    \
720
    {"sub", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_sub, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
721
722
static PyObject *
723
_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl,
724
                          PyObject *string, Py_ssize_t count);
725
726
static PyObject *
727
_sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
728
0
{
729
0
    PyObject *return_value = NULL;
730
0
    static const char * const _keywords[] = {"repl", "string", "count", NULL};
731
0
    static _PyArg_Parser _parser = {NULL, _keywords, "sub", 0};
732
0
    PyObject *argsbuf[3];
733
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
734
0
    PyObject *repl;
735
0
    PyObject *string;
736
0
    Py_ssize_t count = 0;
737
738
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
739
0
    if (!args) {
740
0
        goto exit;
741
0
    }
742
0
    repl = args[0];
743
0
    string = args[1];
744
0
    if (!noptargs) {
745
0
        goto skip_optional_pos;
746
0
    }
747
0
    if (PyFloat_Check(args[2])) {
748
0
        PyErr_SetString(PyExc_TypeError,
749
0
                        "integer argument expected, got float" );
750
0
        goto exit;
751
0
    }
752
0
    {
753
0
        Py_ssize_t ival = -1;
754
0
        PyObject *iobj = PyNumber_Index(args[2]);
755
0
        if (iobj != NULL) {
756
0
            ival = PyLong_AsSsize_t(iobj);
757
0
            Py_DECREF(iobj);
758
0
        }
759
0
        if (ival == -1 && PyErr_Occurred()) {
760
0
            goto exit;
761
0
        }
762
0
        count = ival;
763
0
    }
764
0
skip_optional_pos:
765
0
    return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
766
767
0
exit:
768
0
    return return_value;
769
0
}
770
771
PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
772
"subn($self, /, repl, string, count=0)\n"
773
"--\n"
774
"\n"
775
"Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
776
777
#define _SRE_SRE_PATTERN_SUBN_METHODDEF    \
778
    {"subn", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_subn, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
779
780
static PyObject *
781
_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl,
782
                           PyObject *string, Py_ssize_t count);
783
784
static PyObject *
785
_sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
786
0
{
787
0
    PyObject *return_value = NULL;
788
0
    static const char * const _keywords[] = {"repl", "string", "count", NULL};
789
0
    static _PyArg_Parser _parser = {NULL, _keywords, "subn", 0};
790
0
    PyObject *argsbuf[3];
791
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
792
0
    PyObject *repl;
793
0
    PyObject *string;
794
0
    Py_ssize_t count = 0;
795
796
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
797
0
    if (!args) {
798
0
        goto exit;
799
0
    }
800
0
    repl = args[0];
801
0
    string = args[1];
802
0
    if (!noptargs) {
803
0
        goto skip_optional_pos;
804
0
    }
805
0
    if (PyFloat_Check(args[2])) {
806
0
        PyErr_SetString(PyExc_TypeError,
807
0
                        "integer argument expected, got float" );
808
0
        goto exit;
809
0
    }
810
0
    {
811
0
        Py_ssize_t ival = -1;
812
0
        PyObject *iobj = PyNumber_Index(args[2]);
813
0
        if (iobj != NULL) {
814
0
            ival = PyLong_AsSsize_t(iobj);
815
0
            Py_DECREF(iobj);
816
0
        }
817
0
        if (ival == -1 && PyErr_Occurred()) {
818
0
            goto exit;
819
0
        }
820
0
        count = ival;
821
0
    }
822
0
skip_optional_pos:
823
0
    return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
824
825
0
exit:
826
0
    return return_value;
827
0
}
828
829
PyDoc_STRVAR(_sre_SRE_Pattern___copy____doc__,
830
"__copy__($self, /)\n"
831
"--\n"
832
"\n");
833
834
#define _SRE_SRE_PATTERN___COPY___METHODDEF    \
835
    {"__copy__", (PyCFunction)_sre_SRE_Pattern___copy__, METH_NOARGS, _sre_SRE_Pattern___copy____doc__},
836
837
static PyObject *
838
_sre_SRE_Pattern___copy___impl(PatternObject *self);
839
840
static PyObject *
841
_sre_SRE_Pattern___copy__(PatternObject *self, PyObject *Py_UNUSED(ignored))
842
0
{
843
0
    return _sre_SRE_Pattern___copy___impl(self);
844
0
}
845
846
PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
847
"__deepcopy__($self, memo, /)\n"
848
"--\n"
849
"\n");
850
851
#define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF    \
852
    {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_O, _sre_SRE_Pattern___deepcopy____doc__},
853
854
PyDoc_STRVAR(_sre_compile__doc__,
855
"compile($module, /, pattern, flags, code, groups, groupindex,\n"
856
"        indexgroup)\n"
857
"--\n"
858
"\n");
859
860
#define _SRE_COMPILE_METHODDEF    \
861
    {"compile", (PyCFunction)(void(*)(void))_sre_compile, METH_FASTCALL|METH_KEYWORDS, _sre_compile__doc__},
862
863
static PyObject *
864
_sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
865
                  PyObject *code, Py_ssize_t groups, PyObject *groupindex,
866
                  PyObject *indexgroup);
867
868
static PyObject *
869
_sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
870
8
{
871
8
    PyObject *return_value = NULL;
872
8
    static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
873
8
    static _PyArg_Parser _parser = {NULL, _keywords, "compile", 0};
874
8
    PyObject *argsbuf[6];
875
8
    PyObject *pattern;
876
8
    int flags;
877
8
    PyObject *code;
878
8
    Py_ssize_t groups;
879
8
    PyObject *groupindex;
880
8
    PyObject *indexgroup;
881
882
8
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 6, 6, 0, argsbuf);
883
8
    if (!args) {
884
0
        goto exit;
885
0
    }
886
8
    pattern = args[0];
887
8
    if (PyFloat_Check(args[1])) {
888
0
        PyErr_SetString(PyExc_TypeError,
889
0
                        "integer argument expected, got float" );
890
0
        goto exit;
891
0
    }
892
8
    flags = _PyLong_AsInt(args[1]);
893
8
    if (flags == -1 && PyErr_Occurred()) {
894
0
        goto exit;
895
0
    }
896
8
    if (!PyList_Check(args[2])) {
897
0
        _PyArg_BadArgument("compile", "argument 'code'", "list", args[2]);
898
0
        goto exit;
899
0
    }
900
8
    code = args[2];
901
8
    if (PyFloat_Check(args[3])) {
902
0
        PyErr_SetString(PyExc_TypeError,
903
0
                        "integer argument expected, got float" );
904
0
        goto exit;
905
0
    }
906
8
    {
907
8
        Py_ssize_t ival = -1;
908
8
        PyObject *iobj = PyNumber_Index(args[3]);
909
8
        if (iobj != NULL) {
910
8
            ival = PyLong_AsSsize_t(iobj);
911
8
            Py_DECREF(iobj);
912
8
        }
913
8
        if (ival == -1 && PyErr_Occurred()) {
914
0
            goto exit;
915
0
        }
916
8
        groups = ival;
917
8
    }
918
8
    if (!PyDict_Check(args[4])) {
919
0
        _PyArg_BadArgument("compile", "argument 'groupindex'", "dict", args[4]);
920
0
        goto exit;
921
0
    }
922
8
    groupindex = args[4];
923
8
    if (!PyTuple_Check(args[5])) {
924
0
        _PyArg_BadArgument("compile", "argument 'indexgroup'", "tuple", args[5]);
925
0
        goto exit;
926
0
    }
927
8
    indexgroup = args[5];
928
8
    return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
929
930
8
exit:
931
8
    return return_value;
932
8
}
933
934
PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
935
"expand($self, /, template)\n"
936
"--\n"
937
"\n"
938
"Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.");
939
940
#define _SRE_SRE_MATCH_EXPAND_METHODDEF    \
941
    {"expand", (PyCFunction)(void(*)(void))_sre_SRE_Match_expand, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_expand__doc__},
942
943
static PyObject *
944
_sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template);
945
946
static PyObject *
947
_sre_SRE_Match_expand(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
948
0
{
949
0
    PyObject *return_value = NULL;
950
0
    static const char * const _keywords[] = {"template", NULL};
951
0
    static _PyArg_Parser _parser = {NULL, _keywords, "expand", 0};
952
0
    PyObject *argsbuf[1];
953
0
    PyObject *template;
954
955
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
956
0
    if (!args) {
957
0
        goto exit;
958
0
    }
959
0
    template = args[0];
960
0
    return_value = _sre_SRE_Match_expand_impl(self, template);
961
962
0
exit:
963
0
    return return_value;
964
0
}
965
966
PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
967
"groups($self, /, default=None)\n"
968
"--\n"
969
"\n"
970
"Return a tuple containing all the subgroups of the match, from 1.\n"
971
"\n"
972
"  default\n"
973
"    Is used for groups that did not participate in the match.");
974
975
#define _SRE_SRE_MATCH_GROUPS_METHODDEF    \
976
    {"groups", (PyCFunction)(void(*)(void))_sre_SRE_Match_groups, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groups__doc__},
977
978
static PyObject *
979
_sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value);
980
981
static PyObject *
982
_sre_SRE_Match_groups(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
983
0
{
984
0
    PyObject *return_value = NULL;
985
0
    static const char * const _keywords[] = {"default", NULL};
986
0
    static _PyArg_Parser _parser = {NULL, _keywords, "groups", 0};
987
0
    PyObject *argsbuf[1];
988
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
989
0
    PyObject *default_value = Py_None;
990
991
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
992
0
    if (!args) {
993
0
        goto exit;
994
0
    }
995
0
    if (!noptargs) {
996
0
        goto skip_optional_pos;
997
0
    }
998
0
    default_value = args[0];
999
0
skip_optional_pos:
1000
0
    return_value = _sre_SRE_Match_groups_impl(self, default_value);
1001
1002
0
exit:
1003
0
    return return_value;
1004
0
}
1005
1006
PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
1007
"groupdict($self, /, default=None)\n"
1008
"--\n"
1009
"\n"
1010
"Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\n"
1011
"\n"
1012
"  default\n"
1013
"    Is used for groups that did not participate in the match.");
1014
1015
#define _SRE_SRE_MATCH_GROUPDICT_METHODDEF    \
1016
    {"groupdict", (PyCFunction)(void(*)(void))_sre_SRE_Match_groupdict, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__},
1017
1018
static PyObject *
1019
_sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value);
1020
1021
static PyObject *
1022
_sre_SRE_Match_groupdict(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1023
0
{
1024
0
    PyObject *return_value = NULL;
1025
0
    static const char * const _keywords[] = {"default", NULL};
1026
0
    static _PyArg_Parser _parser = {NULL, _keywords, "groupdict", 0};
1027
0
    PyObject *argsbuf[1];
1028
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
1029
0
    PyObject *default_value = Py_None;
1030
1031
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
1032
0
    if (!args) {
1033
0
        goto exit;
1034
0
    }
1035
0
    if (!noptargs) {
1036
0
        goto skip_optional_pos;
1037
0
    }
1038
0
    default_value = args[0];
1039
0
skip_optional_pos:
1040
0
    return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
1041
1042
0
exit:
1043
0
    return return_value;
1044
0
}
1045
1046
PyDoc_STRVAR(_sre_SRE_Match_start__doc__,
1047
"start($self, group=0, /)\n"
1048
"--\n"
1049
"\n"
1050
"Return index of the start of the substring matched by group.");
1051
1052
#define _SRE_SRE_MATCH_START_METHODDEF    \
1053
    {"start", (PyCFunction)(void(*)(void))_sre_SRE_Match_start, METH_FASTCALL, _sre_SRE_Match_start__doc__},
1054
1055
static Py_ssize_t
1056
_sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
1057
1058
static PyObject *
1059
_sre_SRE_Match_start(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
1060
0
{
1061
0
    PyObject *return_value = NULL;
1062
0
    PyObject *group = NULL;
1063
0
    Py_ssize_t _return_value;
1064
1065
0
    if (!_PyArg_CheckPositional("start", nargs, 0, 1)) {
1066
0
        goto exit;
1067
0
    }
1068
0
    if (nargs < 1) {
1069
0
        goto skip_optional;
1070
0
    }
1071
0
    group = args[0];
1072
0
skip_optional:
1073
0
    _return_value = _sre_SRE_Match_start_impl(self, group);
1074
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1075
0
        goto exit;
1076
0
    }
1077
0
    return_value = PyLong_FromSsize_t(_return_value);
1078
1079
0
exit:
1080
0
    return return_value;
1081
0
}
1082
1083
PyDoc_STRVAR(_sre_SRE_Match_end__doc__,
1084
"end($self, group=0, /)\n"
1085
"--\n"
1086
"\n"
1087
"Return index of the end of the substring matched by group.");
1088
1089
#define _SRE_SRE_MATCH_END_METHODDEF    \
1090
    {"end", (PyCFunction)(void(*)(void))_sre_SRE_Match_end, METH_FASTCALL, _sre_SRE_Match_end__doc__},
1091
1092
static Py_ssize_t
1093
_sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
1094
1095
static PyObject *
1096
_sre_SRE_Match_end(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
1097
0
{
1098
0
    PyObject *return_value = NULL;
1099
0
    PyObject *group = NULL;
1100
0
    Py_ssize_t _return_value;
1101
1102
0
    if (!_PyArg_CheckPositional("end", nargs, 0, 1)) {
1103
0
        goto exit;
1104
0
    }
1105
0
    if (nargs < 1) {
1106
0
        goto skip_optional;
1107
0
    }
1108
0
    group = args[0];
1109
0
skip_optional:
1110
0
    _return_value = _sre_SRE_Match_end_impl(self, group);
1111
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1112
0
        goto exit;
1113
0
    }
1114
0
    return_value = PyLong_FromSsize_t(_return_value);
1115
1116
0
exit:
1117
0
    return return_value;
1118
0
}
1119
1120
PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
1121
"span($self, group=0, /)\n"
1122
"--\n"
1123
"\n"
1124
"For match object m, return the 2-tuple (m.start(group), m.end(group)).");
1125
1126
#define _SRE_SRE_MATCH_SPAN_METHODDEF    \
1127
    {"span", (PyCFunction)(void(*)(void))_sre_SRE_Match_span, METH_FASTCALL, _sre_SRE_Match_span__doc__},
1128
1129
static PyObject *
1130
_sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
1131
1132
static PyObject *
1133
_sre_SRE_Match_span(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
1134
0
{
1135
0
    PyObject *return_value = NULL;
1136
0
    PyObject *group = NULL;
1137
1138
0
    if (!_PyArg_CheckPositional("span", nargs, 0, 1)) {
1139
0
        goto exit;
1140
0
    }
1141
0
    if (nargs < 1) {
1142
0
        goto skip_optional;
1143
0
    }
1144
0
    group = args[0];
1145
0
skip_optional:
1146
0
    return_value = _sre_SRE_Match_span_impl(self, group);
1147
1148
0
exit:
1149
0
    return return_value;
1150
0
}
1151
1152
PyDoc_STRVAR(_sre_SRE_Match___copy____doc__,
1153
"__copy__($self, /)\n"
1154
"--\n"
1155
"\n");
1156
1157
#define _SRE_SRE_MATCH___COPY___METHODDEF    \
1158
    {"__copy__", (PyCFunction)_sre_SRE_Match___copy__, METH_NOARGS, _sre_SRE_Match___copy____doc__},
1159
1160
static PyObject *
1161
_sre_SRE_Match___copy___impl(MatchObject *self);
1162
1163
static PyObject *
1164
_sre_SRE_Match___copy__(MatchObject *self, PyObject *Py_UNUSED(ignored))
1165
0
{
1166
0
    return _sre_SRE_Match___copy___impl(self);
1167
0
}
1168
1169
PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
1170
"__deepcopy__($self, memo, /)\n"
1171
"--\n"
1172
"\n");
1173
1174
#define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF    \
1175
    {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_O, _sre_SRE_Match___deepcopy____doc__},
1176
1177
PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__,
1178
"match($self, /)\n"
1179
"--\n"
1180
"\n");
1181
1182
#define _SRE_SRE_SCANNER_MATCH_METHODDEF    \
1183
    {"match", (PyCFunction)_sre_SRE_Scanner_match, METH_NOARGS, _sre_SRE_Scanner_match__doc__},
1184
1185
static PyObject *
1186
_sre_SRE_Scanner_match_impl(ScannerObject *self);
1187
1188
static PyObject *
1189
_sre_SRE_Scanner_match(ScannerObject *self, PyObject *Py_UNUSED(ignored))
1190
0
{
1191
0
    return _sre_SRE_Scanner_match_impl(self);
1192
0
}
1193
1194
PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__,
1195
"search($self, /)\n"
1196
"--\n"
1197
"\n");
1198
1199
#define _SRE_SRE_SCANNER_SEARCH_METHODDEF    \
1200
    {"search", (PyCFunction)_sre_SRE_Scanner_search, METH_NOARGS, _sre_SRE_Scanner_search__doc__},
1201
1202
static PyObject *
1203
_sre_SRE_Scanner_search_impl(ScannerObject *self);
1204
1205
static PyObject *
1206
_sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
1207
0
{
1208
0
    return _sre_SRE_Scanner_search_impl(self);
1209
0
}
1210
/*[clinic end generated code: output=1adeddce58ae284c input=a9049054013a1b77]*/