LCOV - code coverage report
Current view: top level - Modules/_sre/clinic - sre.c.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 154 461 33.4 %
Date: 2023-03-20 08:15:36 Functions: 13 26 50.0 %
Branches: 63 384 16.4 %

           Branch data     Line data    Source code
       1                 :            : /*[clinic input]
       2                 :            : preserve
       3                 :            : [clinic start generated code]*/
       4                 :            : 
       5                 :            : #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
       6                 :            : #  include "pycore_gc.h"            // PyGC_Head
       7                 :            : #  include "pycore_runtime.h"       // _Py_ID()
       8                 :            : #endif
       9                 :            : 
      10                 :            : 
      11                 :            : PyDoc_STRVAR(_sre_getcodesize__doc__,
      12                 :            : "getcodesize($module, /)\n"
      13                 :            : "--\n"
      14                 :            : "\n");
      15                 :            : 
      16                 :            : #define _SRE_GETCODESIZE_METHODDEF    \
      17                 :            :     {"getcodesize", (PyCFunction)_sre_getcodesize, METH_NOARGS, _sre_getcodesize__doc__},
      18                 :            : 
      19                 :            : static int
      20                 :            : _sre_getcodesize_impl(PyObject *module);
      21                 :            : 
      22                 :            : static PyObject *
      23                 :          0 : _sre_getcodesize(PyObject *module, PyObject *Py_UNUSED(ignored))
      24                 :            : {
      25                 :          0 :     PyObject *return_value = NULL;
      26                 :            :     int _return_value;
      27                 :            : 
      28                 :          0 :     _return_value = _sre_getcodesize_impl(module);
      29   [ #  #  #  # ]:          0 :     if ((_return_value == -1) && PyErr_Occurred()) {
      30                 :          0 :         goto exit;
      31                 :            :     }
      32                 :          0 :     return_value = PyLong_FromLong((long)_return_value);
      33                 :            : 
      34                 :          0 : exit:
      35                 :          0 :     return return_value;
      36                 :            : }
      37                 :            : 
      38                 :            : PyDoc_STRVAR(_sre_ascii_iscased__doc__,
      39                 :            : "ascii_iscased($module, character, /)\n"
      40                 :            : "--\n"
      41                 :            : "\n");
      42                 :            : 
      43                 :            : #define _SRE_ASCII_ISCASED_METHODDEF    \
      44                 :            :     {"ascii_iscased", (PyCFunction)_sre_ascii_iscased, METH_O, _sre_ascii_iscased__doc__},
      45                 :            : 
      46                 :            : static int
      47                 :            : _sre_ascii_iscased_impl(PyObject *module, int character);
      48                 :            : 
      49                 :            : static PyObject *
      50                 :         16 : _sre_ascii_iscased(PyObject *module, PyObject *arg)
      51                 :            : {
      52                 :         16 :     PyObject *return_value = NULL;
      53                 :            :     int character;
      54                 :            :     int _return_value;
      55                 :            : 
      56                 :         16 :     character = _PyLong_AsInt(arg);
      57   [ -  +  -  - ]:         16 :     if (character == -1 && PyErr_Occurred()) {
      58                 :          0 :         goto exit;
      59                 :            :     }
      60                 :         16 :     _return_value = _sre_ascii_iscased_impl(module, character);
      61   [ -  +  -  - ]:         16 :     if ((_return_value == -1) && PyErr_Occurred()) {
      62                 :          0 :         goto exit;
      63                 :            :     }
      64                 :         16 :     return_value = PyBool_FromLong((long)_return_value);
      65                 :            : 
      66                 :         16 : exit:
      67                 :         16 :     return return_value;
      68                 :            : }
      69                 :            : 
      70                 :            : PyDoc_STRVAR(_sre_unicode_iscased__doc__,
      71                 :            : "unicode_iscased($module, character, /)\n"
      72                 :            : "--\n"
      73                 :            : "\n");
      74                 :            : 
      75                 :            : #define _SRE_UNICODE_ISCASED_METHODDEF    \
      76                 :            :     {"unicode_iscased", (PyCFunction)_sre_unicode_iscased, METH_O, _sre_unicode_iscased__doc__},
      77                 :            : 
      78                 :            : static int
      79                 :            : _sre_unicode_iscased_impl(PyObject *module, int character);
      80                 :            : 
      81                 :            : static PyObject *
      82                 :         61 : _sre_unicode_iscased(PyObject *module, PyObject *arg)
      83                 :            : {
      84                 :         61 :     PyObject *return_value = NULL;
      85                 :            :     int character;
      86                 :            :     int _return_value;
      87                 :            : 
      88                 :         61 :     character = _PyLong_AsInt(arg);
      89   [ -  +  -  - ]:         61 :     if (character == -1 && PyErr_Occurred()) {
      90                 :          0 :         goto exit;
      91                 :            :     }
      92                 :         61 :     _return_value = _sre_unicode_iscased_impl(module, character);
      93   [ -  +  -  - ]:         61 :     if ((_return_value == -1) && PyErr_Occurred()) {
      94                 :          0 :         goto exit;
      95                 :            :     }
      96                 :         61 :     return_value = PyBool_FromLong((long)_return_value);
      97                 :            : 
      98                 :         61 : exit:
      99                 :         61 :     return return_value;
     100                 :            : }
     101                 :            : 
     102                 :            : PyDoc_STRVAR(_sre_ascii_tolower__doc__,
     103                 :            : "ascii_tolower($module, character, /)\n"
     104                 :            : "--\n"
     105                 :            : "\n");
     106                 :            : 
     107                 :            : #define _SRE_ASCII_TOLOWER_METHODDEF    \
     108                 :            :     {"ascii_tolower", (PyCFunction)_sre_ascii_tolower, METH_O, _sre_ascii_tolower__doc__},
     109                 :            : 
     110                 :            : static int
     111                 :            : _sre_ascii_tolower_impl(PyObject *module, int character);
     112                 :            : 
     113                 :            : static PyObject *
     114                 :        256 : _sre_ascii_tolower(PyObject *module, PyObject *arg)
     115                 :            : {
     116                 :        256 :     PyObject *return_value = NULL;
     117                 :            :     int character;
     118                 :            :     int _return_value;
     119                 :            : 
     120                 :        256 :     character = _PyLong_AsInt(arg);
     121   [ -  +  -  - ]:        256 :     if (character == -1 && PyErr_Occurred()) {
     122                 :          0 :         goto exit;
     123                 :            :     }
     124                 :        256 :     _return_value = _sre_ascii_tolower_impl(module, character);
     125   [ -  +  -  - ]:        256 :     if ((_return_value == -1) && PyErr_Occurred()) {
     126                 :          0 :         goto exit;
     127                 :            :     }
     128                 :        256 :     return_value = PyLong_FromLong((long)_return_value);
     129                 :            : 
     130                 :        256 : exit:
     131                 :        256 :     return return_value;
     132                 :            : }
     133                 :            : 
     134                 :            : PyDoc_STRVAR(_sre_unicode_tolower__doc__,
     135                 :            : "unicode_tolower($module, character, /)\n"
     136                 :            : "--\n"
     137                 :            : "\n");
     138                 :            : 
     139                 :            : #define _SRE_UNICODE_TOLOWER_METHODDEF    \
     140                 :            :     {"unicode_tolower", (PyCFunction)_sre_unicode_tolower, METH_O, _sre_unicode_tolower__doc__},
     141                 :            : 
     142                 :            : static int
     143                 :            : _sre_unicode_tolower_impl(PyObject *module, int character);
     144                 :            : 
     145                 :            : static PyObject *
     146                 :         84 : _sre_unicode_tolower(PyObject *module, PyObject *arg)
     147                 :            : {
     148                 :         84 :     PyObject *return_value = NULL;
     149                 :            :     int character;
     150                 :            :     int _return_value;
     151                 :            : 
     152                 :         84 :     character = _PyLong_AsInt(arg);
     153   [ -  +  -  - ]:         84 :     if (character == -1 && PyErr_Occurred()) {
     154                 :          0 :         goto exit;
     155                 :            :     }
     156                 :         84 :     _return_value = _sre_unicode_tolower_impl(module, character);
     157   [ -  +  -  - ]:         84 :     if ((_return_value == -1) && PyErr_Occurred()) {
     158                 :          0 :         goto exit;
     159                 :            :     }
     160                 :         84 :     return_value = PyLong_FromLong((long)_return_value);
     161                 :            : 
     162                 :         84 : exit:
     163                 :         84 :     return return_value;
     164                 :            : }
     165                 :            : 
     166                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
     167                 :            : "match($self, /, string, pos=0, endpos=sys.maxsize)\n"
     168                 :            : "--\n"
     169                 :            : "\n"
     170                 :            : "Matches zero or more characters at the beginning of the string.");
     171                 :            : 
     172                 :            : #define _SRE_SRE_PATTERN_MATCH_METHODDEF    \
     173                 :            :     {"match", _PyCFunction_CAST(_sre_SRE_Pattern_match), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
     174                 :            : 
     175                 :            : static PyObject *
     176                 :            : _sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls,
     177                 :            :                             PyObject *string, Py_ssize_t pos,
     178                 :            :                             Py_ssize_t endpos);
     179                 :            : 
     180                 :            : static PyObject *
     181                 :       8726 : _sre_SRE_Pattern_match(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     182                 :            : {
     183                 :       8726 :     PyObject *return_value = NULL;
     184                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     185                 :            : 
     186                 :            :     #define NUM_KEYWORDS 3
     187                 :            :     static struct {
     188                 :            :         PyGC_Head _this_is_not_used;
     189                 :            :         PyObject_VAR_HEAD
     190                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     191                 :            :     } _kwtuple = {
     192                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     193                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
     194                 :            :     };
     195                 :            :     #undef NUM_KEYWORDS
     196                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     197                 :            : 
     198                 :            :     #else  // !Py_BUILD_CORE
     199                 :            :     #  define KWTUPLE NULL
     200                 :            :     #endif  // !Py_BUILD_CORE
     201                 :            : 
     202                 :            :     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
     203                 :            :     static _PyArg_Parser _parser = {
     204                 :            :         .keywords = _keywords,
     205                 :            :         .fname = "match",
     206                 :            :         .kwtuple = KWTUPLE,
     207                 :            :     };
     208                 :            :     #undef KWTUPLE
     209                 :            :     PyObject *argsbuf[3];
     210         [ -  + ]:       8726 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     211                 :            :     PyObject *string;
     212                 :       8726 :     Py_ssize_t pos = 0;
     213                 :       8726 :     Py_ssize_t endpos = PY_SSIZE_T_MAX;
     214                 :            : 
     215   [ +  -  +  -  :       8726 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
             +  -  -  + ]
     216         [ -  + ]:       8726 :     if (!args) {
     217                 :          0 :         goto exit;
     218                 :            :     }
     219                 :       8726 :     string = args[0];
     220         [ +  - ]:       8726 :     if (!noptargs) {
     221                 :       8726 :         goto skip_optional_pos;
     222                 :            :     }
     223         [ #  # ]:          0 :     if (args[1]) {
     224                 :            :         {
     225                 :          0 :             Py_ssize_t ival = -1;
     226                 :          0 :             PyObject *iobj = _PyNumber_Index(args[1]);
     227         [ #  # ]:          0 :             if (iobj != NULL) {
     228                 :          0 :                 ival = PyLong_AsSsize_t(iobj);
     229                 :          0 :                 Py_DECREF(iobj);
     230                 :            :             }
     231   [ #  #  #  # ]:          0 :             if (ival == -1 && PyErr_Occurred()) {
     232                 :          0 :                 goto exit;
     233                 :            :             }
     234                 :          0 :             pos = ival;
     235                 :            :         }
     236         [ #  # ]:          0 :         if (!--noptargs) {
     237                 :          0 :             goto skip_optional_pos;
     238                 :            :         }
     239                 :            :     }
     240                 :            :     {
     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                 :            :         }
     247   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     248                 :          0 :             goto exit;
     249                 :            :         }
     250                 :          0 :         endpos = ival;
     251                 :            :     }
     252                 :       8726 : skip_optional_pos:
     253                 :       8726 :     return_value = _sre_SRE_Pattern_match_impl(self, cls, string, pos, endpos);
     254                 :            : 
     255                 :       8726 : exit:
     256                 :       8726 :     return return_value;
     257                 :            : }
     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_CAST(_sre_SRE_Pattern_fullmatch), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
     267                 :            : 
     268                 :            : static PyObject *
     269                 :            : _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls,
     270                 :            :                                 PyObject *string, Py_ssize_t pos,
     271                 :            :                                 Py_ssize_t endpos);
     272                 :            : 
     273                 :            : static PyObject *
     274                 :          0 : _sre_SRE_Pattern_fullmatch(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     275                 :            : {
     276                 :          0 :     PyObject *return_value = NULL;
     277                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     278                 :            : 
     279                 :            :     #define NUM_KEYWORDS 3
     280                 :            :     static struct {
     281                 :            :         PyGC_Head _this_is_not_used;
     282                 :            :         PyObject_VAR_HEAD
     283                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     284                 :            :     } _kwtuple = {
     285                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     286                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
     287                 :            :     };
     288                 :            :     #undef NUM_KEYWORDS
     289                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     290                 :            : 
     291                 :            :     #else  // !Py_BUILD_CORE
     292                 :            :     #  define KWTUPLE NULL
     293                 :            :     #endif  // !Py_BUILD_CORE
     294                 :            : 
     295                 :            :     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
     296                 :            :     static _PyArg_Parser _parser = {
     297                 :            :         .keywords = _keywords,
     298                 :            :         .fname = "fullmatch",
     299                 :            :         .kwtuple = KWTUPLE,
     300                 :            :     };
     301                 :            :     #undef KWTUPLE
     302                 :            :     PyObject *argsbuf[3];
     303         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     304                 :            :     PyObject *string;
     305                 :          0 :     Py_ssize_t pos = 0;
     306                 :          0 :     Py_ssize_t endpos = PY_SSIZE_T_MAX;
     307                 :            : 
     308   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
             #  #  #  # ]
     309         [ #  # ]:          0 :     if (!args) {
     310                 :          0 :         goto exit;
     311                 :            :     }
     312                 :          0 :     string = args[0];
     313         [ #  # ]:          0 :     if (!noptargs) {
     314                 :          0 :         goto skip_optional_pos;
     315                 :            :     }
     316         [ #  # ]:          0 :     if (args[1]) {
     317                 :            :         {
     318                 :          0 :             Py_ssize_t ival = -1;
     319                 :          0 :             PyObject *iobj = _PyNumber_Index(args[1]);
     320         [ #  # ]:          0 :             if (iobj != NULL) {
     321                 :          0 :                 ival = PyLong_AsSsize_t(iobj);
     322                 :          0 :                 Py_DECREF(iobj);
     323                 :            :             }
     324   [ #  #  #  # ]:          0 :             if (ival == -1 && PyErr_Occurred()) {
     325                 :          0 :                 goto exit;
     326                 :            :             }
     327                 :          0 :             pos = ival;
     328                 :            :         }
     329         [ #  # ]:          0 :         if (!--noptargs) {
     330                 :          0 :             goto skip_optional_pos;
     331                 :            :         }
     332                 :            :     }
     333                 :            :     {
     334                 :          0 :         Py_ssize_t ival = -1;
     335                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     336         [ #  # ]:          0 :         if (iobj != NULL) {
     337                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     338                 :          0 :             Py_DECREF(iobj);
     339                 :            :         }
     340   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     341                 :          0 :             goto exit;
     342                 :            :         }
     343                 :          0 :         endpos = ival;
     344                 :            :     }
     345                 :          0 : skip_optional_pos:
     346                 :          0 :     return_value = _sre_SRE_Pattern_fullmatch_impl(self, cls, string, pos, endpos);
     347                 :            : 
     348                 :          0 : exit:
     349                 :          0 :     return return_value;
     350                 :            : }
     351                 :            : 
     352                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
     353                 :            : "search($self, /, string, pos=0, endpos=sys.maxsize)\n"
     354                 :            : "--\n"
     355                 :            : "\n"
     356                 :            : "Scan through string looking for a match, and return a corresponding match object instance.\n"
     357                 :            : "\n"
     358                 :            : "Return None if no position in the string matches.");
     359                 :            : 
     360                 :            : #define _SRE_SRE_PATTERN_SEARCH_METHODDEF    \
     361                 :            :     {"search", _PyCFunction_CAST(_sre_SRE_Pattern_search), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
     362                 :            : 
     363                 :            : static PyObject *
     364                 :            : _sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls,
     365                 :            :                              PyObject *string, Py_ssize_t pos,
     366                 :            :                              Py_ssize_t endpos);
     367                 :            : 
     368                 :            : static PyObject *
     369                 :        814 : _sre_SRE_Pattern_search(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     370                 :            : {
     371                 :        814 :     PyObject *return_value = NULL;
     372                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     373                 :            : 
     374                 :            :     #define NUM_KEYWORDS 3
     375                 :            :     static struct {
     376                 :            :         PyGC_Head _this_is_not_used;
     377                 :            :         PyObject_VAR_HEAD
     378                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     379                 :            :     } _kwtuple = {
     380                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     381                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
     382                 :            :     };
     383                 :            :     #undef NUM_KEYWORDS
     384                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     385                 :            : 
     386                 :            :     #else  // !Py_BUILD_CORE
     387                 :            :     #  define KWTUPLE NULL
     388                 :            :     #endif  // !Py_BUILD_CORE
     389                 :            : 
     390                 :            :     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
     391                 :            :     static _PyArg_Parser _parser = {
     392                 :            :         .keywords = _keywords,
     393                 :            :         .fname = "search",
     394                 :            :         .kwtuple = KWTUPLE,
     395                 :            :     };
     396                 :            :     #undef KWTUPLE
     397                 :            :     PyObject *argsbuf[3];
     398         [ -  + ]:        814 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     399                 :            :     PyObject *string;
     400                 :        814 :     Py_ssize_t pos = 0;
     401                 :        814 :     Py_ssize_t endpos = PY_SSIZE_T_MAX;
     402                 :            : 
     403   [ +  -  +  -  :        814 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
             +  -  -  + ]
     404         [ -  + ]:        814 :     if (!args) {
     405                 :          0 :         goto exit;
     406                 :            :     }
     407                 :        814 :     string = args[0];
     408         [ +  - ]:        814 :     if (!noptargs) {
     409                 :        814 :         goto skip_optional_pos;
     410                 :            :     }
     411         [ #  # ]:          0 :     if (args[1]) {
     412                 :            :         {
     413                 :          0 :             Py_ssize_t ival = -1;
     414                 :          0 :             PyObject *iobj = _PyNumber_Index(args[1]);
     415         [ #  # ]:          0 :             if (iobj != NULL) {
     416                 :          0 :                 ival = PyLong_AsSsize_t(iobj);
     417                 :          0 :                 Py_DECREF(iobj);
     418                 :            :             }
     419   [ #  #  #  # ]:          0 :             if (ival == -1 && PyErr_Occurred()) {
     420                 :          0 :                 goto exit;
     421                 :            :             }
     422                 :          0 :             pos = ival;
     423                 :            :         }
     424         [ #  # ]:          0 :         if (!--noptargs) {
     425                 :          0 :             goto skip_optional_pos;
     426                 :            :         }
     427                 :            :     }
     428                 :            :     {
     429                 :          0 :         Py_ssize_t ival = -1;
     430                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     431         [ #  # ]:          0 :         if (iobj != NULL) {
     432                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     433                 :          0 :             Py_DECREF(iobj);
     434                 :            :         }
     435   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     436                 :          0 :             goto exit;
     437                 :            :         }
     438                 :          0 :         endpos = ival;
     439                 :            :     }
     440                 :        814 : skip_optional_pos:
     441                 :        814 :     return_value = _sre_SRE_Pattern_search_impl(self, cls, string, pos, endpos);
     442                 :            : 
     443                 :        814 : exit:
     444                 :        814 :     return return_value;
     445                 :            : }
     446                 :            : 
     447                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
     448                 :            : "findall($self, /, string, pos=0, endpos=sys.maxsize)\n"
     449                 :            : "--\n"
     450                 :            : "\n"
     451                 :            : "Return a list of all non-overlapping matches of pattern in string.");
     452                 :            : 
     453                 :            : #define _SRE_SRE_PATTERN_FINDALL_METHODDEF    \
     454                 :            :     {"findall", _PyCFunction_CAST(_sre_SRE_Pattern_findall), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__},
     455                 :            : 
     456                 :            : static PyObject *
     457                 :            : _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
     458                 :            :                               Py_ssize_t pos, Py_ssize_t endpos);
     459                 :            : 
     460                 :            : static PyObject *
     461                 :         41 : _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     462                 :            : {
     463                 :         41 :     PyObject *return_value = NULL;
     464                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     465                 :            : 
     466                 :            :     #define NUM_KEYWORDS 3
     467                 :            :     static struct {
     468                 :            :         PyGC_Head _this_is_not_used;
     469                 :            :         PyObject_VAR_HEAD
     470                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     471                 :            :     } _kwtuple = {
     472                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     473                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
     474                 :            :     };
     475                 :            :     #undef NUM_KEYWORDS
     476                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     477                 :            : 
     478                 :            :     #else  // !Py_BUILD_CORE
     479                 :            :     #  define KWTUPLE NULL
     480                 :            :     #endif  // !Py_BUILD_CORE
     481                 :            : 
     482                 :            :     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
     483                 :            :     static _PyArg_Parser _parser = {
     484                 :            :         .keywords = _keywords,
     485                 :            :         .fname = "findall",
     486                 :            :         .kwtuple = KWTUPLE,
     487                 :            :     };
     488                 :            :     #undef KWTUPLE
     489                 :            :     PyObject *argsbuf[3];
     490         [ -  + ]:         41 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     491                 :            :     PyObject *string;
     492                 :         41 :     Py_ssize_t pos = 0;
     493                 :         41 :     Py_ssize_t endpos = PY_SSIZE_T_MAX;
     494                 :            : 
     495   [ +  -  +  -  :         41 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
             +  -  -  + ]
     496         [ -  + ]:         41 :     if (!args) {
     497                 :          0 :         goto exit;
     498                 :            :     }
     499                 :         41 :     string = args[0];
     500         [ +  - ]:         41 :     if (!noptargs) {
     501                 :         41 :         goto skip_optional_pos;
     502                 :            :     }
     503         [ #  # ]:          0 :     if (args[1]) {
     504                 :            :         {
     505                 :          0 :             Py_ssize_t ival = -1;
     506                 :          0 :             PyObject *iobj = _PyNumber_Index(args[1]);
     507         [ #  # ]:          0 :             if (iobj != NULL) {
     508                 :          0 :                 ival = PyLong_AsSsize_t(iobj);
     509                 :          0 :                 Py_DECREF(iobj);
     510                 :            :             }
     511   [ #  #  #  # ]:          0 :             if (ival == -1 && PyErr_Occurred()) {
     512                 :          0 :                 goto exit;
     513                 :            :             }
     514                 :          0 :             pos = ival;
     515                 :            :         }
     516         [ #  # ]:          0 :         if (!--noptargs) {
     517                 :          0 :             goto skip_optional_pos;
     518                 :            :         }
     519                 :            :     }
     520                 :            :     {
     521                 :          0 :         Py_ssize_t ival = -1;
     522                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     523         [ #  # ]:          0 :         if (iobj != NULL) {
     524                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     525                 :          0 :             Py_DECREF(iobj);
     526                 :            :         }
     527   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     528                 :          0 :             goto exit;
     529                 :            :         }
     530                 :          0 :         endpos = ival;
     531                 :            :     }
     532                 :         41 : skip_optional_pos:
     533                 :         41 :     return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos);
     534                 :            : 
     535                 :         41 : exit:
     536                 :         41 :     return return_value;
     537                 :            : }
     538                 :            : 
     539                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
     540                 :            : "finditer($self, /, string, pos=0, endpos=sys.maxsize)\n"
     541                 :            : "--\n"
     542                 :            : "\n"
     543                 :            : "Return an iterator over all non-overlapping matches for the RE pattern in string.\n"
     544                 :            : "\n"
     545                 :            : "For each match, the iterator returns a match object.");
     546                 :            : 
     547                 :            : #define _SRE_SRE_PATTERN_FINDITER_METHODDEF    \
     548                 :            :     {"finditer", _PyCFunction_CAST(_sre_SRE_Pattern_finditer), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
     549                 :            : 
     550                 :            : static PyObject *
     551                 :            : _sre_SRE_Pattern_finditer_impl(PatternObject *self, PyTypeObject *cls,
     552                 :            :                                PyObject *string, Py_ssize_t pos,
     553                 :            :                                Py_ssize_t endpos);
     554                 :            : 
     555                 :            : static PyObject *
     556                 :    1443749 : _sre_SRE_Pattern_finditer(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     557                 :            : {
     558                 :    1443749 :     PyObject *return_value = NULL;
     559                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     560                 :            : 
     561                 :            :     #define NUM_KEYWORDS 3
     562                 :            :     static struct {
     563                 :            :         PyGC_Head _this_is_not_used;
     564                 :            :         PyObject_VAR_HEAD
     565                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     566                 :            :     } _kwtuple = {
     567                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     568                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
     569                 :            :     };
     570                 :            :     #undef NUM_KEYWORDS
     571                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     572                 :            : 
     573                 :            :     #else  // !Py_BUILD_CORE
     574                 :            :     #  define KWTUPLE NULL
     575                 :            :     #endif  // !Py_BUILD_CORE
     576                 :            : 
     577                 :            :     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
     578                 :            :     static _PyArg_Parser _parser = {
     579                 :            :         .keywords = _keywords,
     580                 :            :         .fname = "finditer",
     581                 :            :         .kwtuple = KWTUPLE,
     582                 :            :     };
     583                 :            :     #undef KWTUPLE
     584                 :            :     PyObject *argsbuf[3];
     585         [ -  + ]:    1443749 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     586                 :            :     PyObject *string;
     587                 :    1443749 :     Py_ssize_t pos = 0;
     588                 :    1443749 :     Py_ssize_t endpos = PY_SSIZE_T_MAX;
     589                 :            : 
     590   [ +  -  +  -  :    1443749 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
             +  -  -  + ]
     591         [ -  + ]:    1443749 :     if (!args) {
     592                 :          0 :         goto exit;
     593                 :            :     }
     594                 :    1443749 :     string = args[0];
     595         [ +  - ]:    1443749 :     if (!noptargs) {
     596                 :    1443749 :         goto skip_optional_pos;
     597                 :            :     }
     598         [ #  # ]:          0 :     if (args[1]) {
     599                 :            :         {
     600                 :          0 :             Py_ssize_t ival = -1;
     601                 :          0 :             PyObject *iobj = _PyNumber_Index(args[1]);
     602         [ #  # ]:          0 :             if (iobj != NULL) {
     603                 :          0 :                 ival = PyLong_AsSsize_t(iobj);
     604                 :          0 :                 Py_DECREF(iobj);
     605                 :            :             }
     606   [ #  #  #  # ]:          0 :             if (ival == -1 && PyErr_Occurred()) {
     607                 :          0 :                 goto exit;
     608                 :            :             }
     609                 :          0 :             pos = ival;
     610                 :            :         }
     611         [ #  # ]:          0 :         if (!--noptargs) {
     612                 :          0 :             goto skip_optional_pos;
     613                 :            :         }
     614                 :            :     }
     615                 :            :     {
     616                 :          0 :         Py_ssize_t ival = -1;
     617                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     618         [ #  # ]:          0 :         if (iobj != NULL) {
     619                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     620                 :          0 :             Py_DECREF(iobj);
     621                 :            :         }
     622   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     623                 :          0 :             goto exit;
     624                 :            :         }
     625                 :          0 :         endpos = ival;
     626                 :            :     }
     627                 :    1443749 : skip_optional_pos:
     628                 :    1443749 :     return_value = _sre_SRE_Pattern_finditer_impl(self, cls, string, pos, endpos);
     629                 :            : 
     630                 :    1443749 : exit:
     631                 :    1443749 :     return return_value;
     632                 :            : }
     633                 :            : 
     634                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
     635                 :            : "scanner($self, /, string, pos=0, endpos=sys.maxsize)\n"
     636                 :            : "--\n"
     637                 :            : "\n");
     638                 :            : 
     639                 :            : #define _SRE_SRE_PATTERN_SCANNER_METHODDEF    \
     640                 :            :     {"scanner", _PyCFunction_CAST(_sre_SRE_Pattern_scanner), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
     641                 :            : 
     642                 :            : static PyObject *
     643                 :            : _sre_SRE_Pattern_scanner_impl(PatternObject *self, PyTypeObject *cls,
     644                 :            :                               PyObject *string, Py_ssize_t pos,
     645                 :            :                               Py_ssize_t endpos);
     646                 :            : 
     647                 :            : static PyObject *
     648                 :          0 : _sre_SRE_Pattern_scanner(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     649                 :            : {
     650                 :          0 :     PyObject *return_value = NULL;
     651                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     652                 :            : 
     653                 :            :     #define NUM_KEYWORDS 3
     654                 :            :     static struct {
     655                 :            :         PyGC_Head _this_is_not_used;
     656                 :            :         PyObject_VAR_HEAD
     657                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     658                 :            :     } _kwtuple = {
     659                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     660                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(pos), &_Py_ID(endpos), },
     661                 :            :     };
     662                 :            :     #undef NUM_KEYWORDS
     663                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     664                 :            : 
     665                 :            :     #else  // !Py_BUILD_CORE
     666                 :            :     #  define KWTUPLE NULL
     667                 :            :     #endif  // !Py_BUILD_CORE
     668                 :            : 
     669                 :            :     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
     670                 :            :     static _PyArg_Parser _parser = {
     671                 :            :         .keywords = _keywords,
     672                 :            :         .fname = "scanner",
     673                 :            :         .kwtuple = KWTUPLE,
     674                 :            :     };
     675                 :            :     #undef KWTUPLE
     676                 :            :     PyObject *argsbuf[3];
     677         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     678                 :            :     PyObject *string;
     679                 :          0 :     Py_ssize_t pos = 0;
     680                 :          0 :     Py_ssize_t endpos = PY_SSIZE_T_MAX;
     681                 :            : 
     682   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
             #  #  #  # ]
     683         [ #  # ]:          0 :     if (!args) {
     684                 :          0 :         goto exit;
     685                 :            :     }
     686                 :          0 :     string = args[0];
     687         [ #  # ]:          0 :     if (!noptargs) {
     688                 :          0 :         goto skip_optional_pos;
     689                 :            :     }
     690         [ #  # ]:          0 :     if (args[1]) {
     691                 :            :         {
     692                 :          0 :             Py_ssize_t ival = -1;
     693                 :          0 :             PyObject *iobj = _PyNumber_Index(args[1]);
     694         [ #  # ]:          0 :             if (iobj != NULL) {
     695                 :          0 :                 ival = PyLong_AsSsize_t(iobj);
     696                 :          0 :                 Py_DECREF(iobj);
     697                 :            :             }
     698   [ #  #  #  # ]:          0 :             if (ival == -1 && PyErr_Occurred()) {
     699                 :          0 :                 goto exit;
     700                 :            :             }
     701                 :          0 :             pos = ival;
     702                 :            :         }
     703         [ #  # ]:          0 :         if (!--noptargs) {
     704                 :          0 :             goto skip_optional_pos;
     705                 :            :         }
     706                 :            :     }
     707                 :            :     {
     708                 :          0 :         Py_ssize_t ival = -1;
     709                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     710         [ #  # ]:          0 :         if (iobj != NULL) {
     711                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     712                 :          0 :             Py_DECREF(iobj);
     713                 :            :         }
     714   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     715                 :          0 :             goto exit;
     716                 :            :         }
     717                 :          0 :         endpos = ival;
     718                 :            :     }
     719                 :          0 : skip_optional_pos:
     720                 :          0 :     return_value = _sre_SRE_Pattern_scanner_impl(self, cls, string, pos, endpos);
     721                 :            : 
     722                 :          0 : exit:
     723                 :          0 :     return return_value;
     724                 :            : }
     725                 :            : 
     726                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
     727                 :            : "split($self, /, string, maxsplit=0)\n"
     728                 :            : "--\n"
     729                 :            : "\n"
     730                 :            : "Split string by the occurrences of pattern.");
     731                 :            : 
     732                 :            : #define _SRE_SRE_PATTERN_SPLIT_METHODDEF    \
     733                 :            :     {"split", _PyCFunction_CAST(_sre_SRE_Pattern_split), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__},
     734                 :            : 
     735                 :            : static PyObject *
     736                 :            : _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
     737                 :            :                             Py_ssize_t maxsplit);
     738                 :            : 
     739                 :            : static PyObject *
     740                 :          0 : _sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     741                 :            : {
     742                 :          0 :     PyObject *return_value = NULL;
     743                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     744                 :            : 
     745                 :            :     #define NUM_KEYWORDS 2
     746                 :            :     static struct {
     747                 :            :         PyGC_Head _this_is_not_used;
     748                 :            :         PyObject_VAR_HEAD
     749                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     750                 :            :     } _kwtuple = {
     751                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     752                 :            :         .ob_item = { &_Py_ID(string), &_Py_ID(maxsplit), },
     753                 :            :     };
     754                 :            :     #undef NUM_KEYWORDS
     755                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     756                 :            : 
     757                 :            :     #else  // !Py_BUILD_CORE
     758                 :            :     #  define KWTUPLE NULL
     759                 :            :     #endif  // !Py_BUILD_CORE
     760                 :            : 
     761                 :            :     static const char * const _keywords[] = {"string", "maxsplit", NULL};
     762                 :            :     static _PyArg_Parser _parser = {
     763                 :            :         .keywords = _keywords,
     764                 :            :         .fname = "split",
     765                 :            :         .kwtuple = KWTUPLE,
     766                 :            :     };
     767                 :            :     #undef KWTUPLE
     768                 :            :     PyObject *argsbuf[2];
     769         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     770                 :            :     PyObject *string;
     771                 :          0 :     Py_ssize_t maxsplit = 0;
     772                 :            : 
     773   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
             #  #  #  # ]
     774         [ #  # ]:          0 :     if (!args) {
     775                 :          0 :         goto exit;
     776                 :            :     }
     777                 :          0 :     string = args[0];
     778         [ #  # ]:          0 :     if (!noptargs) {
     779                 :          0 :         goto skip_optional_pos;
     780                 :            :     }
     781                 :            :     {
     782                 :          0 :         Py_ssize_t ival = -1;
     783                 :          0 :         PyObject *iobj = _PyNumber_Index(args[1]);
     784         [ #  # ]:          0 :         if (iobj != NULL) {
     785                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     786                 :          0 :             Py_DECREF(iobj);
     787                 :            :         }
     788   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     789                 :          0 :             goto exit;
     790                 :            :         }
     791                 :          0 :         maxsplit = ival;
     792                 :            :     }
     793                 :          0 : skip_optional_pos:
     794                 :          0 :     return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit);
     795                 :            : 
     796                 :          0 : exit:
     797                 :          0 :     return return_value;
     798                 :            : }
     799                 :            : 
     800                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
     801                 :            : "sub($self, /, repl, string, count=0)\n"
     802                 :            : "--\n"
     803                 :            : "\n"
     804                 :            : "Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
     805                 :            : 
     806                 :            : #define _SRE_SRE_PATTERN_SUB_METHODDEF    \
     807                 :            :     {"sub", _PyCFunction_CAST(_sre_SRE_Pattern_sub), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
     808                 :            : 
     809                 :            : static PyObject *
     810                 :            : _sre_SRE_Pattern_sub_impl(PatternObject *self, PyTypeObject *cls,
     811                 :            :                           PyObject *repl, PyObject *string, Py_ssize_t count);
     812                 :            : 
     813                 :            : static PyObject *
     814                 :          0 : _sre_SRE_Pattern_sub(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     815                 :            : {
     816                 :          0 :     PyObject *return_value = NULL;
     817                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     818                 :            : 
     819                 :            :     #define NUM_KEYWORDS 3
     820                 :            :     static struct {
     821                 :            :         PyGC_Head _this_is_not_used;
     822                 :            :         PyObject_VAR_HEAD
     823                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     824                 :            :     } _kwtuple = {
     825                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     826                 :            :         .ob_item = { &_Py_ID(repl), &_Py_ID(string), &_Py_ID(count), },
     827                 :            :     };
     828                 :            :     #undef NUM_KEYWORDS
     829                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     830                 :            : 
     831                 :            :     #else  // !Py_BUILD_CORE
     832                 :            :     #  define KWTUPLE NULL
     833                 :            :     #endif  // !Py_BUILD_CORE
     834                 :            : 
     835                 :            :     static const char * const _keywords[] = {"repl", "string", "count", NULL};
     836                 :            :     static _PyArg_Parser _parser = {
     837                 :            :         .keywords = _keywords,
     838                 :            :         .fname = "sub",
     839                 :            :         .kwtuple = KWTUPLE,
     840                 :            :     };
     841                 :            :     #undef KWTUPLE
     842                 :            :     PyObject *argsbuf[3];
     843         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
     844                 :            :     PyObject *repl;
     845                 :            :     PyObject *string;
     846                 :          0 :     Py_ssize_t count = 0;
     847                 :            : 
     848   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
             #  #  #  # ]
     849         [ #  # ]:          0 :     if (!args) {
     850                 :          0 :         goto exit;
     851                 :            :     }
     852                 :          0 :     repl = args[0];
     853                 :          0 :     string = args[1];
     854         [ #  # ]:          0 :     if (!noptargs) {
     855                 :          0 :         goto skip_optional_pos;
     856                 :            :     }
     857                 :            :     {
     858                 :          0 :         Py_ssize_t ival = -1;
     859                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     860         [ #  # ]:          0 :         if (iobj != NULL) {
     861                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     862                 :          0 :             Py_DECREF(iobj);
     863                 :            :         }
     864   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     865                 :          0 :             goto exit;
     866                 :            :         }
     867                 :          0 :         count = ival;
     868                 :            :     }
     869                 :          0 : skip_optional_pos:
     870                 :          0 :     return_value = _sre_SRE_Pattern_sub_impl(self, cls, repl, string, count);
     871                 :            : 
     872                 :          0 : exit:
     873                 :          0 :     return return_value;
     874                 :            : }
     875                 :            : 
     876                 :            : PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
     877                 :            : "subn($self, /, repl, string, count=0)\n"
     878                 :            : "--\n"
     879                 :            : "\n"
     880                 :            : "Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
     881                 :            : 
     882                 :            : #define _SRE_SRE_PATTERN_SUBN_METHODDEF    \
     883                 :            :     {"subn", _PyCFunction_CAST(_sre_SRE_Pattern_subn), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
     884                 :            : 
     885                 :            : static PyObject *
     886                 :            : _sre_SRE_Pattern_subn_impl(PatternObject *self, PyTypeObject *cls,
     887                 :            :                            PyObject *repl, PyObject *string,
     888                 :            :                            Py_ssize_t count);
     889                 :            : 
     890                 :            : static PyObject *
     891                 :          0 : _sre_SRE_Pattern_subn(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     892                 :            : {
     893                 :          0 :     PyObject *return_value = NULL;
     894                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     895                 :            : 
     896                 :            :     #define NUM_KEYWORDS 3
     897                 :            :     static struct {
     898                 :            :         PyGC_Head _this_is_not_used;
     899                 :            :         PyObject_VAR_HEAD
     900                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     901                 :            :     } _kwtuple = {
     902                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     903                 :            :         .ob_item = { &_Py_ID(repl), &_Py_ID(string), &_Py_ID(count), },
     904                 :            :     };
     905                 :            :     #undef NUM_KEYWORDS
     906                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     907                 :            : 
     908                 :            :     #else  // !Py_BUILD_CORE
     909                 :            :     #  define KWTUPLE NULL
     910                 :            :     #endif  // !Py_BUILD_CORE
     911                 :            : 
     912                 :            :     static const char * const _keywords[] = {"repl", "string", "count", NULL};
     913                 :            :     static _PyArg_Parser _parser = {
     914                 :            :         .keywords = _keywords,
     915                 :            :         .fname = "subn",
     916                 :            :         .kwtuple = KWTUPLE,
     917                 :            :     };
     918                 :            :     #undef KWTUPLE
     919                 :            :     PyObject *argsbuf[3];
     920         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
     921                 :            :     PyObject *repl;
     922                 :            :     PyObject *string;
     923                 :          0 :     Py_ssize_t count = 0;
     924                 :            : 
     925   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
             #  #  #  # ]
     926         [ #  # ]:          0 :     if (!args) {
     927                 :          0 :         goto exit;
     928                 :            :     }
     929                 :          0 :     repl = args[0];
     930                 :          0 :     string = args[1];
     931         [ #  # ]:          0 :     if (!noptargs) {
     932                 :          0 :         goto skip_optional_pos;
     933                 :            :     }
     934                 :            :     {
     935                 :          0 :         Py_ssize_t ival = -1;
     936                 :          0 :         PyObject *iobj = _PyNumber_Index(args[2]);
     937         [ #  # ]:          0 :         if (iobj != NULL) {
     938                 :          0 :             ival = PyLong_AsSsize_t(iobj);
     939                 :          0 :             Py_DECREF(iobj);
     940                 :            :         }
     941   [ #  #  #  # ]:          0 :         if (ival == -1 && PyErr_Occurred()) {
     942                 :          0 :             goto exit;
     943                 :            :         }
     944                 :          0 :         count = ival;
     945                 :            :     }
     946                 :          0 : skip_optional_pos:
     947                 :          0 :     return_value = _sre_SRE_Pattern_subn_impl(self, cls, repl, string, count);
     948                 :            : 
     949                 :          0 : exit:
     950                 :          0 :     return return_value;
     951                 :            : }
     952                 :            : 
     953                 :            : PyDoc_STRVAR(_sre_SRE_Pattern___copy____doc__,
     954                 :            : "__copy__($self, /)\n"
     955                 :            : "--\n"
     956                 :            : "\n");
     957                 :            : 
     958                 :            : #define _SRE_SRE_PATTERN___COPY___METHODDEF    \
     959                 :            :     {"__copy__", (PyCFunction)_sre_SRE_Pattern___copy__, METH_NOARGS, _sre_SRE_Pattern___copy____doc__},
     960                 :            : 
     961                 :            : static PyObject *
     962                 :            : _sre_SRE_Pattern___copy___impl(PatternObject *self);
     963                 :            : 
     964                 :            : static PyObject *
     965                 :          0 : _sre_SRE_Pattern___copy__(PatternObject *self, PyObject *Py_UNUSED(ignored))
     966                 :            : {
     967                 :          0 :     return _sre_SRE_Pattern___copy___impl(self);
     968                 :            : }
     969                 :            : 
     970                 :            : PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
     971                 :            : "__deepcopy__($self, memo, /)\n"
     972                 :            : "--\n"
     973                 :            : "\n");
     974                 :            : 
     975                 :            : #define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF    \
     976                 :            :     {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_O, _sre_SRE_Pattern___deepcopy____doc__},
     977                 :            : 
     978                 :            : PyDoc_STRVAR(_sre_compile__doc__,
     979                 :            : "compile($module, /, pattern, flags, code, groups, groupindex,\n"
     980                 :            : "        indexgroup)\n"
     981                 :            : "--\n"
     982                 :            : "\n");
     983                 :            : 
     984                 :            : #define _SRE_COMPILE_METHODDEF    \
     985                 :            :     {"compile", _PyCFunction_CAST(_sre_compile), METH_FASTCALL|METH_KEYWORDS, _sre_compile__doc__},
     986                 :            : 
     987                 :            : static PyObject *
     988                 :            : _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
     989                 :            :                   PyObject *code, Py_ssize_t groups, PyObject *groupindex,
     990                 :            :                   PyObject *indexgroup);
     991                 :            : 
     992                 :            : static PyObject *
     993                 :         80 : _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     994                 :            : {
     995                 :         80 :     PyObject *return_value = NULL;
     996                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     997                 :            : 
     998                 :            :     #define NUM_KEYWORDS 6
     999                 :            :     static struct {
    1000                 :            :         PyGC_Head _this_is_not_used;
    1001                 :            :         PyObject_VAR_HEAD
    1002                 :            :         PyObject *ob_item[NUM_KEYWORDS];
    1003                 :            :     } _kwtuple = {
    1004                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
    1005                 :            :         .ob_item = { &_Py_ID(pattern), &_Py_ID(flags), &_Py_ID(code), &_Py_ID(groups), &_Py_ID(groupindex), &_Py_ID(indexgroup), },
    1006                 :            :     };
    1007                 :            :     #undef NUM_KEYWORDS
    1008                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
    1009                 :            : 
    1010                 :            :     #else  // !Py_BUILD_CORE
    1011                 :            :     #  define KWTUPLE NULL
    1012                 :            :     #endif  // !Py_BUILD_CORE
    1013                 :            : 
    1014                 :            :     static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
    1015                 :            :     static _PyArg_Parser _parser = {
    1016                 :            :         .keywords = _keywords,
    1017                 :            :         .fname = "compile",
    1018                 :            :         .kwtuple = KWTUPLE,
    1019                 :            :     };
    1020                 :            :     #undef KWTUPLE
    1021                 :            :     PyObject *argsbuf[6];
    1022                 :            :     PyObject *pattern;
    1023                 :            :     int flags;
    1024                 :            :     PyObject *code;
    1025                 :            :     Py_ssize_t groups;
    1026                 :            :     PyObject *groupindex;
    1027                 :            :     PyObject *indexgroup;
    1028                 :            : 
    1029   [ +  -  +  -  :         80 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 6, 6, 0, argsbuf);
             +  -  -  + ]
    1030         [ -  + ]:         80 :     if (!args) {
    1031                 :          0 :         goto exit;
    1032                 :            :     }
    1033                 :         80 :     pattern = args[0];
    1034                 :         80 :     flags = _PyLong_AsInt(args[1]);
    1035   [ -  +  -  - ]:         80 :     if (flags == -1 && PyErr_Occurred()) {
    1036                 :          0 :         goto exit;
    1037                 :            :     }
    1038         [ -  + ]:         80 :     if (!PyList_Check(args[2])) {
    1039                 :          0 :         _PyArg_BadArgument("compile", "argument 'code'", "list", args[2]);
    1040                 :          0 :         goto exit;
    1041                 :            :     }
    1042                 :         80 :     code = args[2];
    1043                 :            :     {
    1044                 :         80 :         Py_ssize_t ival = -1;
    1045                 :         80 :         PyObject *iobj = _PyNumber_Index(args[3]);
    1046         [ +  - ]:         80 :         if (iobj != NULL) {
    1047                 :         80 :             ival = PyLong_AsSsize_t(iobj);
    1048                 :         80 :             Py_DECREF(iobj);
    1049                 :            :         }
    1050   [ -  +  -  - ]:         80 :         if (ival == -1 && PyErr_Occurred()) {
    1051                 :          0 :             goto exit;
    1052                 :            :         }
    1053                 :         80 :         groups = ival;
    1054                 :            :     }
    1055         [ -  + ]:         80 :     if (!PyDict_Check(args[4])) {
    1056                 :          0 :         _PyArg_BadArgument("compile", "argument 'groupindex'", "dict", args[4]);
    1057                 :          0 :         goto exit;
    1058                 :            :     }
    1059                 :         80 :     groupindex = args[4];
    1060         [ -  + ]:         80 :     if (!PyTuple_Check(args[5])) {
    1061                 :          0 :         _PyArg_BadArgument("compile", "argument 'indexgroup'", "tuple", args[5]);
    1062                 :          0 :         goto exit;
    1063                 :            :     }
    1064                 :         80 :     indexgroup = args[5];
    1065                 :         80 :     return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
    1066                 :            : 
    1067                 :         80 : exit:
    1068                 :         80 :     return return_value;
    1069                 :            : }
    1070                 :            : 
    1071                 :            : PyDoc_STRVAR(_sre_template__doc__,
    1072                 :            : "template($module, pattern, template, /)\n"
    1073                 :            : "--\n"
    1074                 :            : "\n"
    1075                 :            : "\n"
    1076                 :            : "\n"
    1077                 :            : "  template\n"
    1078                 :            : "    A list containing interleaved literal strings (str or bytes) and group\n"
    1079                 :            : "    indices (int), as returned by re._parser.parse_template():\n"
    1080                 :            : "        [literal1, group1, ..., literalN, groupN]");
    1081                 :            : 
    1082                 :            : #define _SRE_TEMPLATE_METHODDEF    \
    1083                 :            :     {"template", _PyCFunction_CAST(_sre_template), METH_FASTCALL, _sre_template__doc__},
    1084                 :            : 
    1085                 :            : static PyObject *
    1086                 :            : _sre_template_impl(PyObject *module, PyObject *pattern, PyObject *template);
    1087                 :            : 
    1088                 :            : static PyObject *
    1089                 :          0 : _sre_template(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
    1090                 :            : {
    1091                 :          0 :     PyObject *return_value = NULL;
    1092                 :            :     PyObject *pattern;
    1093                 :            :     PyObject *template;
    1094                 :            : 
    1095   [ #  #  #  #  :          0 :     if (!_PyArg_CheckPositional("template", nargs, 2, 2)) {
                   #  # ]
    1096                 :          0 :         goto exit;
    1097                 :            :     }
    1098                 :          0 :     pattern = args[0];
    1099         [ #  # ]:          0 :     if (!PyList_Check(args[1])) {
    1100                 :          0 :         _PyArg_BadArgument("template", "argument 2", "list", args[1]);
    1101                 :          0 :         goto exit;
    1102                 :            :     }
    1103                 :          0 :     template = args[1];
    1104                 :          0 :     return_value = _sre_template_impl(module, pattern, template);
    1105                 :            : 
    1106                 :          0 : exit:
    1107                 :          0 :     return return_value;
    1108                 :            : }
    1109                 :            : 
    1110                 :            : PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
    1111                 :            : "expand($self, /, template)\n"
    1112                 :            : "--\n"
    1113                 :            : "\n"
    1114                 :            : "Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.");
    1115                 :            : 
    1116                 :            : #define _SRE_SRE_MATCH_EXPAND_METHODDEF    \
    1117                 :            :     {"expand", _PyCFunction_CAST(_sre_SRE_Match_expand), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_expand__doc__},
    1118                 :            : 
    1119                 :            : static PyObject *
    1120                 :            : _sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template);
    1121                 :            : 
    1122                 :            : static PyObject *
    1123                 :          0 : _sre_SRE_Match_expand(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    1124                 :            : {
    1125                 :          0 :     PyObject *return_value = NULL;
    1126                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
    1127                 :            : 
    1128                 :            :     #define NUM_KEYWORDS 1
    1129                 :            :     static struct {
    1130                 :            :         PyGC_Head _this_is_not_used;
    1131                 :            :         PyObject_VAR_HEAD
    1132                 :            :         PyObject *ob_item[NUM_KEYWORDS];
    1133                 :            :     } _kwtuple = {
    1134                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
    1135                 :            :         .ob_item = { &_Py_ID(template), },
    1136                 :            :     };
    1137                 :            :     #undef NUM_KEYWORDS
    1138                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
    1139                 :            : 
    1140                 :            :     #else  // !Py_BUILD_CORE
    1141                 :            :     #  define KWTUPLE NULL
    1142                 :            :     #endif  // !Py_BUILD_CORE
    1143                 :            : 
    1144                 :            :     static const char * const _keywords[] = {"template", NULL};
    1145                 :            :     static _PyArg_Parser _parser = {
    1146                 :            :         .keywords = _keywords,
    1147                 :            :         .fname = "expand",
    1148                 :            :         .kwtuple = KWTUPLE,
    1149                 :            :     };
    1150                 :            :     #undef KWTUPLE
    1151                 :            :     PyObject *argsbuf[1];
    1152                 :            :     PyObject *template;
    1153                 :            : 
    1154   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
             #  #  #  # ]
    1155         [ #  # ]:          0 :     if (!args) {
    1156                 :          0 :         goto exit;
    1157                 :            :     }
    1158                 :          0 :     template = args[0];
    1159                 :          0 :     return_value = _sre_SRE_Match_expand_impl(self, template);
    1160                 :            : 
    1161                 :          0 : exit:
    1162                 :          0 :     return return_value;
    1163                 :            : }
    1164                 :            : 
    1165                 :            : PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
    1166                 :            : "groups($self, /, default=None)\n"
    1167                 :            : "--\n"
    1168                 :            : "\n"
    1169                 :            : "Return a tuple containing all the subgroups of the match, from 1.\n"
    1170                 :            : "\n"
    1171                 :            : "  default\n"
    1172                 :            : "    Is used for groups that did not participate in the match.");
    1173                 :            : 
    1174                 :            : #define _SRE_SRE_MATCH_GROUPS_METHODDEF    \
    1175                 :            :     {"groups", _PyCFunction_CAST(_sre_SRE_Match_groups), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groups__doc__},
    1176                 :            : 
    1177                 :            : static PyObject *
    1178                 :            : _sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value);
    1179                 :            : 
    1180                 :            : static PyObject *
    1181                 :       1728 : _sre_SRE_Match_groups(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    1182                 :            : {
    1183                 :       1728 :     PyObject *return_value = NULL;
    1184                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
    1185                 :            : 
    1186                 :            :     #define NUM_KEYWORDS 1
    1187                 :            :     static struct {
    1188                 :            :         PyGC_Head _this_is_not_used;
    1189                 :            :         PyObject_VAR_HEAD
    1190                 :            :         PyObject *ob_item[NUM_KEYWORDS];
    1191                 :            :     } _kwtuple = {
    1192                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
    1193                 :            :         .ob_item = { &_Py_ID(default), },
    1194                 :            :     };
    1195                 :            :     #undef NUM_KEYWORDS
    1196                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
    1197                 :            : 
    1198                 :            :     #else  // !Py_BUILD_CORE
    1199                 :            :     #  define KWTUPLE NULL
    1200                 :            :     #endif  // !Py_BUILD_CORE
    1201                 :            : 
    1202                 :            :     static const char * const _keywords[] = {"default", NULL};
    1203                 :            :     static _PyArg_Parser _parser = {
    1204                 :            :         .keywords = _keywords,
    1205                 :            :         .fname = "groups",
    1206                 :            :         .kwtuple = KWTUPLE,
    1207                 :            :     };
    1208                 :            :     #undef KWTUPLE
    1209                 :            :     PyObject *argsbuf[1];
    1210         [ -  + ]:       1728 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
    1211                 :       1728 :     PyObject *default_value = Py_None;
    1212                 :            : 
    1213   [ +  -  +  -  :       1728 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
             +  -  -  + ]
    1214         [ -  + ]:       1728 :     if (!args) {
    1215                 :          0 :         goto exit;
    1216                 :            :     }
    1217         [ +  - ]:       1728 :     if (!noptargs) {
    1218                 :       1728 :         goto skip_optional_pos;
    1219                 :            :     }
    1220                 :          0 :     default_value = args[0];
    1221                 :       1728 : skip_optional_pos:
    1222                 :       1728 :     return_value = _sre_SRE_Match_groups_impl(self, default_value);
    1223                 :            : 
    1224                 :       1728 : exit:
    1225                 :       1728 :     return return_value;
    1226                 :            : }
    1227                 :            : 
    1228                 :            : PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
    1229                 :            : "groupdict($self, /, default=None)\n"
    1230                 :            : "--\n"
    1231                 :            : "\n"
    1232                 :            : "Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\n"
    1233                 :            : "\n"
    1234                 :            : "  default\n"
    1235                 :            : "    Is used for groups that did not participate in the match.");
    1236                 :            : 
    1237                 :            : #define _SRE_SRE_MATCH_GROUPDICT_METHODDEF    \
    1238                 :            :     {"groupdict", _PyCFunction_CAST(_sre_SRE_Match_groupdict), METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__},
    1239                 :            : 
    1240                 :            : static PyObject *
    1241                 :            : _sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value);
    1242                 :            : 
    1243                 :            : static PyObject *
    1244                 :          0 : _sre_SRE_Match_groupdict(MatchObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    1245                 :            : {
    1246                 :          0 :     PyObject *return_value = NULL;
    1247                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
    1248                 :            : 
    1249                 :            :     #define NUM_KEYWORDS 1
    1250                 :            :     static struct {
    1251                 :            :         PyGC_Head _this_is_not_used;
    1252                 :            :         PyObject_VAR_HEAD
    1253                 :            :         PyObject *ob_item[NUM_KEYWORDS];
    1254                 :            :     } _kwtuple = {
    1255                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
    1256                 :            :         .ob_item = { &_Py_ID(default), },
    1257                 :            :     };
    1258                 :            :     #undef NUM_KEYWORDS
    1259                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
    1260                 :            : 
    1261                 :            :     #else  // !Py_BUILD_CORE
    1262                 :            :     #  define KWTUPLE NULL
    1263                 :            :     #endif  // !Py_BUILD_CORE
    1264                 :            : 
    1265                 :            :     static const char * const _keywords[] = {"default", NULL};
    1266                 :            :     static _PyArg_Parser _parser = {
    1267                 :            :         .keywords = _keywords,
    1268                 :            :         .fname = "groupdict",
    1269                 :            :         .kwtuple = KWTUPLE,
    1270                 :            :     };
    1271                 :            :     #undef KWTUPLE
    1272                 :            :     PyObject *argsbuf[1];
    1273         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
    1274                 :          0 :     PyObject *default_value = Py_None;
    1275                 :            : 
    1276   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
             #  #  #  # ]
    1277         [ #  # ]:          0 :     if (!args) {
    1278                 :          0 :         goto exit;
    1279                 :            :     }
    1280         [ #  # ]:          0 :     if (!noptargs) {
    1281                 :          0 :         goto skip_optional_pos;
    1282                 :            :     }
    1283                 :          0 :     default_value = args[0];
    1284                 :          0 : skip_optional_pos:
    1285                 :          0 :     return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
    1286                 :            : 
    1287                 :          0 : exit:
    1288                 :          0 :     return return_value;
    1289                 :            : }
    1290                 :            : 
    1291                 :            : PyDoc_STRVAR(_sre_SRE_Match_start__doc__,
    1292                 :            : "start($self, group=0, /)\n"
    1293                 :            : "--\n"
    1294                 :            : "\n"
    1295                 :            : "Return index of the start of the substring matched by group.");
    1296                 :            : 
    1297                 :            : #define _SRE_SRE_MATCH_START_METHODDEF    \
    1298                 :            :     {"start", _PyCFunction_CAST(_sre_SRE_Match_start), METH_FASTCALL, _sre_SRE_Match_start__doc__},
    1299                 :            : 
    1300                 :            : static Py_ssize_t
    1301                 :            : _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
    1302                 :            : 
    1303                 :            : static PyObject *
    1304                 :        498 : _sre_SRE_Match_start(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
    1305                 :            : {
    1306                 :        498 :     PyObject *return_value = NULL;
    1307                 :        498 :     PyObject *group = NULL;
    1308                 :            :     Py_ssize_t _return_value;
    1309                 :            : 
    1310   [ +  -  -  +  :        498 :     if (!_PyArg_CheckPositional("start", nargs, 0, 1)) {
                   -  - ]
    1311                 :          0 :         goto exit;
    1312                 :            :     }
    1313         [ +  - ]:        498 :     if (nargs < 1) {
    1314                 :        498 :         goto skip_optional;
    1315                 :            :     }
    1316                 :          0 :     group = args[0];
    1317                 :        498 : skip_optional:
    1318                 :        498 :     _return_value = _sre_SRE_Match_start_impl(self, group);
    1319   [ -  +  -  - ]:        498 :     if ((_return_value == -1) && PyErr_Occurred()) {
    1320                 :          0 :         goto exit;
    1321                 :            :     }
    1322                 :        498 :     return_value = PyLong_FromSsize_t(_return_value);
    1323                 :            : 
    1324                 :        498 : exit:
    1325                 :        498 :     return return_value;
    1326                 :            : }
    1327                 :            : 
    1328                 :            : PyDoc_STRVAR(_sre_SRE_Match_end__doc__,
    1329                 :            : "end($self, group=0, /)\n"
    1330                 :            : "--\n"
    1331                 :            : "\n"
    1332                 :            : "Return index of the end of the substring matched by group.");
    1333                 :            : 
    1334                 :            : #define _SRE_SRE_MATCH_END_METHODDEF    \
    1335                 :            :     {"end", _PyCFunction_CAST(_sre_SRE_Match_end), METH_FASTCALL, _sre_SRE_Match_end__doc__},
    1336                 :            : 
    1337                 :            : static Py_ssize_t
    1338                 :            : _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
    1339                 :            : 
    1340                 :            : static PyObject *
    1341                 :        442 : _sre_SRE_Match_end(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
    1342                 :            : {
    1343                 :        442 :     PyObject *return_value = NULL;
    1344                 :        442 :     PyObject *group = NULL;
    1345                 :            :     Py_ssize_t _return_value;
    1346                 :            : 
    1347   [ +  -  -  +  :        442 :     if (!_PyArg_CheckPositional("end", nargs, 0, 1)) {
                   -  - ]
    1348                 :          0 :         goto exit;
    1349                 :            :     }
    1350         [ +  - ]:        442 :     if (nargs < 1) {
    1351                 :        442 :         goto skip_optional;
    1352                 :            :     }
    1353                 :          0 :     group = args[0];
    1354                 :        442 : skip_optional:
    1355                 :        442 :     _return_value = _sre_SRE_Match_end_impl(self, group);
    1356   [ -  +  -  - ]:        442 :     if ((_return_value == -1) && PyErr_Occurred()) {
    1357                 :          0 :         goto exit;
    1358                 :            :     }
    1359                 :        442 :     return_value = PyLong_FromSsize_t(_return_value);
    1360                 :            : 
    1361                 :        442 : exit:
    1362                 :        442 :     return return_value;
    1363                 :            : }
    1364                 :            : 
    1365                 :            : PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
    1366                 :            : "span($self, group=0, /)\n"
    1367                 :            : "--\n"
    1368                 :            : "\n"
    1369                 :            : "For match object m, return the 2-tuple (m.start(group), m.end(group)).");
    1370                 :            : 
    1371                 :            : #define _SRE_SRE_MATCH_SPAN_METHODDEF    \
    1372                 :            :     {"span", _PyCFunction_CAST(_sre_SRE_Match_span), METH_FASTCALL, _sre_SRE_Match_span__doc__},
    1373                 :            : 
    1374                 :            : static PyObject *
    1375                 :            : _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
    1376                 :            : 
    1377                 :            : static PyObject *
    1378                 :          0 : _sre_SRE_Match_span(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
    1379                 :            : {
    1380                 :          0 :     PyObject *return_value = NULL;
    1381                 :          0 :     PyObject *group = NULL;
    1382                 :            : 
    1383   [ #  #  #  #  :          0 :     if (!_PyArg_CheckPositional("span", nargs, 0, 1)) {
                   #  # ]
    1384                 :          0 :         goto exit;
    1385                 :            :     }
    1386         [ #  # ]:          0 :     if (nargs < 1) {
    1387                 :          0 :         goto skip_optional;
    1388                 :            :     }
    1389                 :          0 :     group = args[0];
    1390                 :          0 : skip_optional:
    1391                 :          0 :     return_value = _sre_SRE_Match_span_impl(self, group);
    1392                 :            : 
    1393                 :          0 : exit:
    1394                 :          0 :     return return_value;
    1395                 :            : }
    1396                 :            : 
    1397                 :            : PyDoc_STRVAR(_sre_SRE_Match___copy____doc__,
    1398                 :            : "__copy__($self, /)\n"
    1399                 :            : "--\n"
    1400                 :            : "\n");
    1401                 :            : 
    1402                 :            : #define _SRE_SRE_MATCH___COPY___METHODDEF    \
    1403                 :            :     {"__copy__", (PyCFunction)_sre_SRE_Match___copy__, METH_NOARGS, _sre_SRE_Match___copy____doc__},
    1404                 :            : 
    1405                 :            : static PyObject *
    1406                 :            : _sre_SRE_Match___copy___impl(MatchObject *self);
    1407                 :            : 
    1408                 :            : static PyObject *
    1409                 :          0 : _sre_SRE_Match___copy__(MatchObject *self, PyObject *Py_UNUSED(ignored))
    1410                 :            : {
    1411                 :          0 :     return _sre_SRE_Match___copy___impl(self);
    1412                 :            : }
    1413                 :            : 
    1414                 :            : PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
    1415                 :            : "__deepcopy__($self, memo, /)\n"
    1416                 :            : "--\n"
    1417                 :            : "\n");
    1418                 :            : 
    1419                 :            : #define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF    \
    1420                 :            :     {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_O, _sre_SRE_Match___deepcopy____doc__},
    1421                 :            : 
    1422                 :            : PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__,
    1423                 :            : "match($self, /)\n"
    1424                 :            : "--\n"
    1425                 :            : "\n");
    1426                 :            : 
    1427                 :            : #define _SRE_SRE_SCANNER_MATCH_METHODDEF    \
    1428                 :            :     {"match", _PyCFunction_CAST(_sre_SRE_Scanner_match), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_match__doc__},
    1429                 :            : 
    1430                 :            : static PyObject *
    1431                 :            : _sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls);
    1432                 :            : 
    1433                 :            : static PyObject *
    1434                 :          0 : _sre_SRE_Scanner_match(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    1435                 :            : {
    1436         [ #  # ]:          0 :     if (nargs) {
    1437                 :          0 :         PyErr_SetString(PyExc_TypeError, "match() takes no arguments");
    1438                 :          0 :         return NULL;
    1439                 :            :     }
    1440                 :          0 :     return _sre_SRE_Scanner_match_impl(self, cls);
    1441                 :            : }
    1442                 :            : 
    1443                 :            : PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__,
    1444                 :            : "search($self, /)\n"
    1445                 :            : "--\n"
    1446                 :            : "\n");
    1447                 :            : 
    1448                 :            : #define _SRE_SRE_SCANNER_SEARCH_METHODDEF    \
    1449                 :            :     {"search", _PyCFunction_CAST(_sre_SRE_Scanner_search), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_search__doc__},
    1450                 :            : 
    1451                 :            : static PyObject *
    1452                 :            : _sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls);
    1453                 :            : 
    1454                 :            : static PyObject *
    1455                 :    1445532 : _sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
    1456                 :            : {
    1457         [ -  + ]:    1445532 :     if (nargs) {
    1458                 :          0 :         PyErr_SetString(PyExc_TypeError, "search() takes no arguments");
    1459                 :          0 :         return NULL;
    1460                 :            :     }
    1461                 :    1445532 :     return _sre_SRE_Scanner_search_impl(self, cls);
    1462                 :            : }
    1463                 :            : /*[clinic end generated code: output=e3ba72156dd71572 input=a9049054013a1b77]*/

Generated by: LCOV version 1.14