LCOV - code coverage report
Current view: top level - Modules/clinic - arraymodule.c.h (source / functions) Hit Total Coverage
Test: CPython lcov report Lines: 145 164 88.4 %
Date: 2022-07-07 18:19:46 Functions: 19 19 100.0 %

          Line data    Source code
       1             : /*[clinic input]
       2             : preserve
       3             : [clinic start generated code]*/
       4             : 
       5             : PyDoc_STRVAR(array_array___copy____doc__,
       6             : "__copy__($self, /)\n"
       7             : "--\n"
       8             : "\n"
       9             : "Return a copy of the array.");
      10             : 
      11             : #define ARRAY_ARRAY___COPY___METHODDEF    \
      12             :     {"__copy__", (PyCFunction)array_array___copy__, METH_NOARGS, array_array___copy____doc__},
      13             : 
      14             : static PyObject *
      15             : array_array___copy___impl(arrayobject *self);
      16             : 
      17             : static PyObject *
      18          13 : array_array___copy__(arrayobject *self, PyObject *Py_UNUSED(ignored))
      19             : {
      20          13 :     return array_array___copy___impl(self);
      21             : }
      22             : 
      23             : PyDoc_STRVAR(array_array___deepcopy____doc__,
      24             : "__deepcopy__($self, unused, /)\n"
      25             : "--\n"
      26             : "\n"
      27             : "Return a copy of the array.");
      28             : 
      29             : #define ARRAY_ARRAY___DEEPCOPY___METHODDEF    \
      30             :     {"__deepcopy__", (PyCFunction)array_array___deepcopy__, METH_O, array_array___deepcopy____doc__},
      31             : 
      32             : PyDoc_STRVAR(array_array_count__doc__,
      33             : "count($self, v, /)\n"
      34             : "--\n"
      35             : "\n"
      36             : "Return number of occurrences of v in the array.");
      37             : 
      38             : #define ARRAY_ARRAY_COUNT_METHODDEF    \
      39             :     {"count", (PyCFunction)array_array_count, METH_O, array_array_count__doc__},
      40             : 
      41             : PyDoc_STRVAR(array_array_index__doc__,
      42             : "index($self, v, start=0, stop=sys.maxsize, /)\n"
      43             : "--\n"
      44             : "\n"
      45             : "Return index of first occurrence of v in the array.\n"
      46             : "\n"
      47             : "Raise ValueError if the value is not present.");
      48             : 
      49             : #define ARRAY_ARRAY_INDEX_METHODDEF    \
      50             :     {"index", _PyCFunction_CAST(array_array_index), METH_FASTCALL, array_array_index__doc__},
      51             : 
      52             : static PyObject *
      53             : array_array_index_impl(arrayobject *self, PyObject *v, Py_ssize_t start,
      54             :                        Py_ssize_t stop);
      55             : 
      56             : static PyObject *
      57         298 : array_array_index(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
      58             : {
      59         298 :     PyObject *return_value = NULL;
      60             :     PyObject *v;
      61         298 :     Py_ssize_t start = 0;
      62         298 :     Py_ssize_t stop = PY_SSIZE_T_MAX;
      63             : 
      64         298 :     if (!_PyArg_CheckPositional("index", nargs, 1, 3)) {
      65          13 :         goto exit;
      66             :     }
      67         285 :     v = args[0];
      68         285 :     if (nargs < 2) {
      69         181 :         goto skip_optional;
      70             :     }
      71         104 :     if (!_PyEval_SliceIndexNotNone(args[1], &start)) {
      72           0 :         goto exit;
      73             :     }
      74         104 :     if (nargs < 3) {
      75          65 :         goto skip_optional;
      76             :     }
      77          39 :     if (!_PyEval_SliceIndexNotNone(args[2], &stop)) {
      78           0 :         goto exit;
      79             :     }
      80          39 : skip_optional:
      81         285 :     return_value = array_array_index_impl(self, v, start, stop);
      82             : 
      83         298 : exit:
      84         298 :     return return_value;
      85             : }
      86             : 
      87             : PyDoc_STRVAR(array_array_remove__doc__,
      88             : "remove($self, v, /)\n"
      89             : "--\n"
      90             : "\n"
      91             : "Remove the first occurrence of v in the array.");
      92             : 
      93             : #define ARRAY_ARRAY_REMOVE_METHODDEF    \
      94             :     {"remove", (PyCFunction)array_array_remove, METH_O, array_array_remove__doc__},
      95             : 
      96             : PyDoc_STRVAR(array_array_pop__doc__,
      97             : "pop($self, i=-1, /)\n"
      98             : "--\n"
      99             : "\n"
     100             : "Return the i-th element and delete it from the array.\n"
     101             : "\n"
     102             : "i defaults to -1.");
     103             : 
     104             : #define ARRAY_ARRAY_POP_METHODDEF    \
     105             :     {"pop", _PyCFunction_CAST(array_array_pop), METH_FASTCALL, array_array_pop__doc__},
     106             : 
     107             : static PyObject *
     108             : array_array_pop_impl(arrayobject *self, Py_ssize_t i);
     109             : 
     110             : static PyObject *
     111         136 : array_array_pop(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
     112             : {
     113         136 :     PyObject *return_value = NULL;
     114         136 :     Py_ssize_t i = -1;
     115             : 
     116         136 :     if (!_PyArg_CheckPositional("pop", nargs, 0, 1)) {
     117          13 :         goto exit;
     118             :     }
     119         123 :     if (nargs < 1) {
     120          29 :         goto skip_optional;
     121             :     }
     122             :     {
     123          94 :         Py_ssize_t ival = -1;
     124          94 :         PyObject *iobj = _PyNumber_Index(args[0]);
     125          94 :         if (iobj != NULL) {
     126          81 :             ival = PyLong_AsSsize_t(iobj);
     127          81 :             Py_DECREF(iobj);
     128             :         }
     129          94 :         if (ival == -1 && PyErr_Occurred()) {
     130          13 :             goto exit;
     131             :         }
     132          81 :         i = ival;
     133             :     }
     134         110 : skip_optional:
     135         110 :     return_value = array_array_pop_impl(self, i);
     136             : 
     137         136 : exit:
     138         136 :     return return_value;
     139             : }
     140             : 
     141             : PyDoc_STRVAR(array_array_extend__doc__,
     142             : "extend($self, bb, /)\n"
     143             : "--\n"
     144             : "\n"
     145             : "Append items to the end of the array.");
     146             : 
     147             : #define ARRAY_ARRAY_EXTEND_METHODDEF    \
     148             :     {"extend", _PyCFunction_CAST(array_array_extend), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, array_array_extend__doc__},
     149             : 
     150             : static PyObject *
     151             : array_array_extend_impl(arrayobject *self, PyTypeObject *cls, PyObject *bb);
     152             : 
     153             : static PyObject *
     154          89 : array_array_extend(arrayobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     155             : {
     156          89 :     PyObject *return_value = NULL;
     157             :     static const char * const _keywords[] = {"", NULL};
     158             :     static _PyArg_Parser _parser = {NULL, _keywords, "extend", 0};
     159             :     PyObject *argsbuf[1];
     160             :     PyObject *bb;
     161             : 
     162          89 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
     163          89 :     if (!args) {
     164          13 :         goto exit;
     165             :     }
     166          76 :     bb = args[0];
     167          76 :     return_value = array_array_extend_impl(self, cls, bb);
     168             : 
     169          89 : exit:
     170          89 :     return return_value;
     171             : }
     172             : 
     173             : PyDoc_STRVAR(array_array_insert__doc__,
     174             : "insert($self, i, v, /)\n"
     175             : "--\n"
     176             : "\n"
     177             : "Insert a new item v into the array before position i.");
     178             : 
     179             : #define ARRAY_ARRAY_INSERT_METHODDEF    \
     180             :     {"insert", _PyCFunction_CAST(array_array_insert), METH_FASTCALL, array_array_insert__doc__},
     181             : 
     182             : static PyObject *
     183             : array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v);
     184             : 
     185             : static PyObject *
     186         419 : array_array_insert(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
     187             : {
     188         419 :     PyObject *return_value = NULL;
     189             :     Py_ssize_t i;
     190             :     PyObject *v;
     191             : 
     192         419 :     if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
     193          26 :         goto exit;
     194             :     }
     195             :     {
     196         393 :         Py_ssize_t ival = -1;
     197         393 :         PyObject *iobj = _PyNumber_Index(args[0]);
     198         393 :         if (iobj != NULL) {
     199         393 :             ival = PyLong_AsSsize_t(iobj);
     200         393 :             Py_DECREF(iobj);
     201             :         }
     202         393 :         if (ival == -1 && PyErr_Occurred()) {
     203           0 :             goto exit;
     204             :         }
     205         393 :         i = ival;
     206             :     }
     207         393 :     v = args[1];
     208         393 :     return_value = array_array_insert_impl(self, i, v);
     209             : 
     210         419 : exit:
     211         419 :     return return_value;
     212             : }
     213             : 
     214             : PyDoc_STRVAR(array_array_buffer_info__doc__,
     215             : "buffer_info($self, /)\n"
     216             : "--\n"
     217             : "\n"
     218             : "Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array\'s contents.\n"
     219             : "\n"
     220             : "The length should be multiplied by the itemsize attribute to calculate\n"
     221             : "the buffer length in bytes.");
     222             : 
     223             : #define ARRAY_ARRAY_BUFFER_INFO_METHODDEF    \
     224             :     {"buffer_info", (PyCFunction)array_array_buffer_info, METH_NOARGS, array_array_buffer_info__doc__},
     225             : 
     226             : static PyObject *
     227             : array_array_buffer_info_impl(arrayobject *self);
     228             : 
     229             : static PyObject *
     230          41 : array_array_buffer_info(arrayobject *self, PyObject *Py_UNUSED(ignored))
     231             : {
     232          41 :     return array_array_buffer_info_impl(self);
     233             : }
     234             : 
     235             : PyDoc_STRVAR(array_array_append__doc__,
     236             : "append($self, v, /)\n"
     237             : "--\n"
     238             : "\n"
     239             : "Append new value v to the end of the array.");
     240             : 
     241             : #define ARRAY_ARRAY_APPEND_METHODDEF    \
     242             :     {"append", (PyCFunction)array_array_append, METH_O, array_array_append__doc__},
     243             : 
     244             : PyDoc_STRVAR(array_array_byteswap__doc__,
     245             : "byteswap($self, /)\n"
     246             : "--\n"
     247             : "\n"
     248             : "Byteswap all items of the array.\n"
     249             : "\n"
     250             : "If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is\n"
     251             : "raised.");
     252             : 
     253             : #define ARRAY_ARRAY_BYTESWAP_METHODDEF    \
     254             :     {"byteswap", (PyCFunction)array_array_byteswap, METH_NOARGS, array_array_byteswap__doc__},
     255             : 
     256             : static PyObject *
     257             : array_array_byteswap_impl(arrayobject *self);
     258             : 
     259             : static PyObject *
     260          42 : array_array_byteswap(arrayobject *self, PyObject *Py_UNUSED(ignored))
     261             : {
     262          42 :     return array_array_byteswap_impl(self);
     263             : }
     264             : 
     265             : PyDoc_STRVAR(array_array_reverse__doc__,
     266             : "reverse($self, /)\n"
     267             : "--\n"
     268             : "\n"
     269             : "Reverse the order of the items in the array.");
     270             : 
     271             : #define ARRAY_ARRAY_REVERSE_METHODDEF    \
     272             :     {"reverse", (PyCFunction)array_array_reverse, METH_NOARGS, array_array_reverse__doc__},
     273             : 
     274             : static PyObject *
     275             : array_array_reverse_impl(arrayobject *self);
     276             : 
     277             : static PyObject *
     278          15 : array_array_reverse(arrayobject *self, PyObject *Py_UNUSED(ignored))
     279             : {
     280          15 :     return array_array_reverse_impl(self);
     281             : }
     282             : 
     283             : PyDoc_STRVAR(array_array_fromfile__doc__,
     284             : "fromfile($self, f, n, /)\n"
     285             : "--\n"
     286             : "\n"
     287             : "Read n objects from the file object f and append them to the end of the array.");
     288             : 
     289             : #define ARRAY_ARRAY_FROMFILE_METHODDEF    \
     290             :     {"fromfile", _PyCFunction_CAST(array_array_fromfile), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, array_array_fromfile__doc__},
     291             : 
     292             : static PyObject *
     293             : array_array_fromfile_impl(arrayobject *self, PyTypeObject *cls, PyObject *f,
     294             :                           Py_ssize_t n);
     295             : 
     296             : static PyObject *
     297         102 : array_array_fromfile(arrayobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     298             : {
     299         102 :     PyObject *return_value = NULL;
     300             :     static const char * const _keywords[] = {"", "", NULL};
     301             :     static _PyArg_Parser _parser = {NULL, _keywords, "fromfile", 0};
     302             :     PyObject *argsbuf[2];
     303             :     PyObject *f;
     304             :     Py_ssize_t n;
     305             : 
     306         102 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
     307         102 :     if (!args) {
     308          13 :         goto exit;
     309             :     }
     310          89 :     f = args[0];
     311             :     {
     312          89 :         Py_ssize_t ival = -1;
     313          89 :         PyObject *iobj = _PyNumber_Index(args[1]);
     314          89 :         if (iobj != NULL) {
     315          89 :             ival = PyLong_AsSsize_t(iobj);
     316          89 :             Py_DECREF(iobj);
     317             :         }
     318          89 :         if (ival == -1 && PyErr_Occurred()) {
     319           0 :             goto exit;
     320             :         }
     321          89 :         n = ival;
     322             :     }
     323          89 :     return_value = array_array_fromfile_impl(self, cls, f, n);
     324             : 
     325         102 : exit:
     326         102 :     return return_value;
     327             : }
     328             : 
     329             : PyDoc_STRVAR(array_array_tofile__doc__,
     330             : "tofile($self, f, /)\n"
     331             : "--\n"
     332             : "\n"
     333             : "Write all items (as machine values) to the file object f.");
     334             : 
     335             : #define ARRAY_ARRAY_TOFILE_METHODDEF    \
     336             :     {"tofile", _PyCFunction_CAST(array_array_tofile), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, array_array_tofile__doc__},
     337             : 
     338             : static PyObject *
     339             : array_array_tofile_impl(arrayobject *self, PyTypeObject *cls, PyObject *f);
     340             : 
     341             : static PyObject *
     342          26 : array_array_tofile(arrayobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     343             : {
     344          26 :     PyObject *return_value = NULL;
     345             :     static const char * const _keywords[] = {"", NULL};
     346             :     static _PyArg_Parser _parser = {NULL, _keywords, "tofile", 0};
     347             :     PyObject *argsbuf[1];
     348             :     PyObject *f;
     349             : 
     350          26 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
     351          26 :     if (!args) {
     352          13 :         goto exit;
     353             :     }
     354          13 :     f = args[0];
     355          13 :     return_value = array_array_tofile_impl(self, cls, f);
     356             : 
     357          26 : exit:
     358          26 :     return return_value;
     359             : }
     360             : 
     361             : PyDoc_STRVAR(array_array_fromlist__doc__,
     362             : "fromlist($self, list, /)\n"
     363             : "--\n"
     364             : "\n"
     365             : "Append items to array from list.");
     366             : 
     367             : #define ARRAY_ARRAY_FROMLIST_METHODDEF    \
     368             :     {"fromlist", (PyCFunction)array_array_fromlist, METH_O, array_array_fromlist__doc__},
     369             : 
     370             : PyDoc_STRVAR(array_array_tolist__doc__,
     371             : "tolist($self, /)\n"
     372             : "--\n"
     373             : "\n"
     374             : "Convert array to an ordinary list with the same items.");
     375             : 
     376             : #define ARRAY_ARRAY_TOLIST_METHODDEF    \
     377             :     {"tolist", (PyCFunction)array_array_tolist, METH_NOARGS, array_array_tolist__doc__},
     378             : 
     379             : static PyObject *
     380             : array_array_tolist_impl(arrayobject *self);
     381             : 
     382             : static PyObject *
     383        1576 : array_array_tolist(arrayobject *self, PyObject *Py_UNUSED(ignored))
     384             : {
     385        1576 :     return array_array_tolist_impl(self);
     386             : }
     387             : 
     388             : PyDoc_STRVAR(array_array_frombytes__doc__,
     389             : "frombytes($self, buffer, /)\n"
     390             : "--\n"
     391             : "\n"
     392             : "Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method.");
     393             : 
     394             : #define ARRAY_ARRAY_FROMBYTES_METHODDEF    \
     395             :     {"frombytes", (PyCFunction)array_array_frombytes, METH_O, array_array_frombytes__doc__},
     396             : 
     397             : static PyObject *
     398             : array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer);
     399             : 
     400             : static PyObject *
     401        1314 : array_array_frombytes(arrayobject *self, PyObject *arg)
     402             : {
     403        1314 :     PyObject *return_value = NULL;
     404        1314 :     Py_buffer buffer = {NULL, NULL};
     405             : 
     406        1314 :     if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
     407          13 :         goto exit;
     408             :     }
     409        1301 :     if (!PyBuffer_IsContiguous(&buffer, 'C')) {
     410           0 :         _PyArg_BadArgument("frombytes", "argument", "contiguous buffer", arg);
     411           0 :         goto exit;
     412             :     }
     413        1301 :     return_value = array_array_frombytes_impl(self, &buffer);
     414             : 
     415        1314 : exit:
     416             :     /* Cleanup for buffer */
     417        1314 :     if (buffer.obj) {
     418           0 :        PyBuffer_Release(&buffer);
     419             :     }
     420             : 
     421        1314 :     return return_value;
     422             : }
     423             : 
     424             : PyDoc_STRVAR(array_array_tobytes__doc__,
     425             : "tobytes($self, /)\n"
     426             : "--\n"
     427             : "\n"
     428             : "Convert the array to an array of machine values and return the bytes representation.");
     429             : 
     430             : #define ARRAY_ARRAY_TOBYTES_METHODDEF    \
     431             :     {"tobytes", (PyCFunction)array_array_tobytes, METH_NOARGS, array_array_tobytes__doc__},
     432             : 
     433             : static PyObject *
     434             : array_array_tobytes_impl(arrayobject *self);
     435             : 
     436             : static PyObject *
     437        1687 : array_array_tobytes(arrayobject *self, PyObject *Py_UNUSED(ignored))
     438             : {
     439        1687 :     return array_array_tobytes_impl(self);
     440             : }
     441             : 
     442             : PyDoc_STRVAR(array_array_fromunicode__doc__,
     443             : "fromunicode($self, ustr, /)\n"
     444             : "--\n"
     445             : "\n"
     446             : "Extends this array with data from the unicode string ustr.\n"
     447             : "\n"
     448             : "The array must be a unicode type array; otherwise a ValueError is raised.\n"
     449             : "Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of\n"
     450             : "some other type.");
     451             : 
     452             : #define ARRAY_ARRAY_FROMUNICODE_METHODDEF    \
     453             :     {"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__},
     454             : 
     455             : static PyObject *
     456             : array_array_fromunicode_impl(arrayobject *self, PyObject *ustr);
     457             : 
     458             : static PyObject *
     459           5 : array_array_fromunicode(arrayobject *self, PyObject *arg)
     460             : {
     461           5 :     PyObject *return_value = NULL;
     462             :     PyObject *ustr;
     463             : 
     464           5 :     if (!PyUnicode_Check(arg)) {
     465           0 :         _PyArg_BadArgument("fromunicode", "argument", "str", arg);
     466           0 :         goto exit;
     467             :     }
     468           5 :     if (PyUnicode_READY(arg) == -1) {
     469           0 :         goto exit;
     470             :     }
     471           5 :     ustr = arg;
     472           5 :     return_value = array_array_fromunicode_impl(self, ustr);
     473             : 
     474           5 : exit:
     475           5 :     return return_value;
     476             : }
     477             : 
     478             : PyDoc_STRVAR(array_array_tounicode__doc__,
     479             : "tounicode($self, /)\n"
     480             : "--\n"
     481             : "\n"
     482             : "Extends this array with data from the unicode string ustr.\n"
     483             : "\n"
     484             : "Convert the array to a unicode string.  The array must be a unicode type array;\n"
     485             : "otherwise a ValueError is raised.  Use array.tobytes().decode() to obtain a\n"
     486             : "unicode string from an array of some other type.");
     487             : 
     488             : #define ARRAY_ARRAY_TOUNICODE_METHODDEF    \
     489             :     {"tounicode", (PyCFunction)array_array_tounicode, METH_NOARGS, array_array_tounicode__doc__},
     490             : 
     491             : static PyObject *
     492             : array_array_tounicode_impl(arrayobject *self);
     493             : 
     494             : static PyObject *
     495           3 : array_array_tounicode(arrayobject *self, PyObject *Py_UNUSED(ignored))
     496             : {
     497           3 :     return array_array_tounicode_impl(self);
     498             : }
     499             : 
     500             : PyDoc_STRVAR(array_array___sizeof____doc__,
     501             : "__sizeof__($self, /)\n"
     502             : "--\n"
     503             : "\n"
     504             : "Size of the array in memory, in bytes.");
     505             : 
     506             : #define ARRAY_ARRAY___SIZEOF___METHODDEF    \
     507             :     {"__sizeof__", (PyCFunction)array_array___sizeof__, METH_NOARGS, array_array___sizeof____doc__},
     508             : 
     509             : static PyObject *
     510             : array_array___sizeof___impl(arrayobject *self);
     511             : 
     512             : static PyObject *
     513          26 : array_array___sizeof__(arrayobject *self, PyObject *Py_UNUSED(ignored))
     514             : {
     515          26 :     return array_array___sizeof___impl(self);
     516             : }
     517             : 
     518             : PyDoc_STRVAR(array__array_reconstructor__doc__,
     519             : "_array_reconstructor($module, arraytype, typecode, mformat_code, items,\n"
     520             : "                     /)\n"
     521             : "--\n"
     522             : "\n"
     523             : "Internal. Used for pickling support.");
     524             : 
     525             : #define ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF    \
     526             :     {"_array_reconstructor", _PyCFunction_CAST(array__array_reconstructor), METH_FASTCALL, array__array_reconstructor__doc__},
     527             : 
     528             : static PyObject *
     529             : array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
     530             :                                 int typecode,
     531             :                                 enum machine_format_code mformat_code,
     532             :                                 PyObject *items);
     533             : 
     534             : static PyObject *
     535         520 : array__array_reconstructor(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     536             : {
     537         520 :     PyObject *return_value = NULL;
     538             :     PyTypeObject *arraytype;
     539             :     int typecode;
     540             :     enum machine_format_code mformat_code;
     541             :     PyObject *items;
     542             : 
     543         520 :     if (!_PyArg_CheckPositional("_array_reconstructor", nargs, 4, 4)) {
     544           0 :         goto exit;
     545             :     }
     546         520 :     arraytype = (PyTypeObject *)args[0];
     547         520 :     if (!PyUnicode_Check(args[1])) {
     548           0 :         _PyArg_BadArgument("_array_reconstructor", "argument 2", "a unicode character", args[1]);
     549           0 :         goto exit;
     550             :     }
     551         520 :     if (PyUnicode_READY(args[1])) {
     552           0 :         goto exit;
     553             :     }
     554         520 :     if (PyUnicode_GET_LENGTH(args[1]) != 1) {
     555           0 :         _PyArg_BadArgument("_array_reconstructor", "argument 2", "a unicode character", args[1]);
     556           0 :         goto exit;
     557             :     }
     558         520 :     typecode = PyUnicode_READ_CHAR(args[1], 0);
     559         520 :     mformat_code = _PyLong_AsInt(args[2]);
     560         520 :     if (mformat_code == -1 && PyErr_Occurred()) {
     561           1 :         goto exit;
     562             :     }
     563         519 :     items = args[3];
     564         519 :     return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
     565             : 
     566         520 : exit:
     567         520 :     return return_value;
     568             : }
     569             : 
     570             : PyDoc_STRVAR(array_array___reduce_ex____doc__,
     571             : "__reduce_ex__($self, value, /)\n"
     572             : "--\n"
     573             : "\n"
     574             : "Return state information for pickling.");
     575             : 
     576             : #define ARRAY_ARRAY___REDUCE_EX___METHODDEF    \
     577             :     {"__reduce_ex__", _PyCFunction_CAST(array_array___reduce_ex__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, array_array___reduce_ex____doc__},
     578             : 
     579             : static PyObject *
     580             : array_array___reduce_ex___impl(arrayobject *self, PyTypeObject *cls,
     581             :                                PyObject *value);
     582             : 
     583             : static PyObject *
     584        1014 : array_array___reduce_ex__(arrayobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     585             : {
     586        1014 :     PyObject *return_value = NULL;
     587             :     static const char * const _keywords[] = {"", NULL};
     588             :     static _PyArg_Parser _parser = {NULL, _keywords, "__reduce_ex__", 0};
     589             :     PyObject *argsbuf[1];
     590             :     PyObject *value;
     591             : 
     592        1014 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
     593        1014 :     if (!args) {
     594           0 :         goto exit;
     595             :     }
     596        1014 :     value = args[0];
     597        1014 :     return_value = array_array___reduce_ex___impl(self, cls, value);
     598             : 
     599        1014 : exit:
     600        1014 :     return return_value;
     601             : }
     602             : 
     603             : PyDoc_STRVAR(array_arrayiterator___reduce____doc__,
     604             : "__reduce__($self, /)\n"
     605             : "--\n"
     606             : "\n"
     607             : "Return state information for pickling.");
     608             : 
     609             : #define ARRAY_ARRAYITERATOR___REDUCE___METHODDEF    \
     610             :     {"__reduce__", _PyCFunction_CAST(array_arrayiterator___reduce__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, array_arrayiterator___reduce____doc__},
     611             : 
     612             : static PyObject *
     613             : array_arrayiterator___reduce___impl(arrayiterobject *self, PyTypeObject *cls);
     614             : 
     615             : static PyObject *
     616         312 : array_arrayiterator___reduce__(arrayiterobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     617             : {
     618         312 :     if (nargs) {
     619           0 :         PyErr_SetString(PyExc_TypeError, "__reduce__() takes no arguments");
     620           0 :         return NULL;
     621             :     }
     622         312 :     return array_arrayiterator___reduce___impl(self, cls);
     623             : }
     624             : 
     625             : PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
     626             : "__setstate__($self, state, /)\n"
     627             : "--\n"
     628             : "\n"
     629             : "Set state information for unpickling.");
     630             : 
     631             : #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF    \
     632             :     {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
     633             : /*[clinic end generated code: output=85a5fec90d9615b9 input=a9049054013a1b77]*/

Generated by: LCOV version 1.14