LCOV - code coverage report
Current view: top level - Objects/clinic - enumobject.c.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 0 28 0.0 %
Date: 2023-03-20 08:15:36 Functions: 0 2 0.0 %
Branches: 0 28 0.0 %

           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(enum_new__doc__,
      12                 :            : "enumerate(iterable, start=0)\n"
      13                 :            : "--\n"
      14                 :            : "\n"
      15                 :            : "Return an enumerate object.\n"
      16                 :            : "\n"
      17                 :            : "  iterable\n"
      18                 :            : "    an object supporting iteration\n"
      19                 :            : "\n"
      20                 :            : "The enumerate object yields pairs containing a count (from start, which\n"
      21                 :            : "defaults to zero) and a value yielded by the iterable argument.\n"
      22                 :            : "\n"
      23                 :            : "enumerate is useful for obtaining an indexed list:\n"
      24                 :            : "    (0, seq[0]), (1, seq[1]), (2, seq[2]), ...");
      25                 :            : 
      26                 :            : static PyObject *
      27                 :            : enum_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start);
      28                 :            : 
      29                 :            : static PyObject *
      30                 :          0 : enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
      31                 :            : {
      32                 :          0 :     PyObject *return_value = NULL;
      33                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
      34                 :            : 
      35                 :            :     #define NUM_KEYWORDS 2
      36                 :            :     static struct {
      37                 :            :         PyGC_Head _this_is_not_used;
      38                 :            :         PyObject_VAR_HEAD
      39                 :            :         PyObject *ob_item[NUM_KEYWORDS];
      40                 :            :     } _kwtuple = {
      41                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
      42                 :            :         .ob_item = { &_Py_ID(iterable), &_Py_ID(start), },
      43                 :            :     };
      44                 :            :     #undef NUM_KEYWORDS
      45                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
      46                 :            : 
      47                 :            :     #else  // !Py_BUILD_CORE
      48                 :            :     #  define KWTUPLE NULL
      49                 :            :     #endif  // !Py_BUILD_CORE
      50                 :            : 
      51                 :            :     static const char * const _keywords[] = {"iterable", "start", NULL};
      52                 :            :     static _PyArg_Parser _parser = {
      53                 :            :         .keywords = _keywords,
      54                 :            :         .fname = "enumerate",
      55                 :            :         .kwtuple = KWTUPLE,
      56                 :            :     };
      57                 :            :     #undef KWTUPLE
      58                 :            :     PyObject *argsbuf[2];
      59                 :            :     PyObject * const *fastargs;
      60                 :          0 :     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
      61         [ #  # ]:          0 :     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
      62                 :            :     PyObject *iterable;
      63                 :          0 :     PyObject *start = 0;
      64                 :            : 
      65   [ #  #  #  #  :          0 :     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
             #  #  #  # ]
      66         [ #  # ]:          0 :     if (!fastargs) {
      67                 :          0 :         goto exit;
      68                 :            :     }
      69                 :          0 :     iterable = fastargs[0];
      70         [ #  # ]:          0 :     if (!noptargs) {
      71                 :          0 :         goto skip_optional_pos;
      72                 :            :     }
      73                 :          0 :     start = fastargs[1];
      74                 :          0 : skip_optional_pos:
      75                 :          0 :     return_value = enum_new_impl(type, iterable, start);
      76                 :            : 
      77                 :          0 : exit:
      78                 :          0 :     return return_value;
      79                 :            : }
      80                 :            : 
      81                 :            : PyDoc_STRVAR(reversed_new__doc__,
      82                 :            : "reversed(sequence, /)\n"
      83                 :            : "--\n"
      84                 :            : "\n"
      85                 :            : "Return a reverse iterator over the values of the given sequence.");
      86                 :            : 
      87                 :            : static PyObject *
      88                 :            : reversed_new_impl(PyTypeObject *type, PyObject *seq);
      89                 :            : 
      90                 :            : static PyObject *
      91                 :          0 : reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
      92                 :            : {
      93                 :          0 :     PyObject *return_value = NULL;
      94                 :          0 :     PyTypeObject *base_tp = &PyReversed_Type;
      95                 :            :     PyObject *seq;
      96                 :            : 
      97   [ #  #  #  #  :          0 :     if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
                   #  # ]
      98         [ #  # ]:          0 :         !_PyArg_NoKeywords("reversed", kwargs)) {
      99                 :          0 :         goto exit;
     100                 :            :     }
     101   [ #  #  #  #  :          0 :     if (!_PyArg_CheckPositional("reversed", PyTuple_GET_SIZE(args), 1, 1)) {
                   #  # ]
     102                 :          0 :         goto exit;
     103                 :            :     }
     104                 :          0 :     seq = PyTuple_GET_ITEM(args, 0);
     105                 :          0 :     return_value = reversed_new_impl(type, seq);
     106                 :            : 
     107                 :          0 : exit:
     108                 :          0 :     return return_value;
     109                 :            : }
     110                 :            : /*[clinic end generated code: output=aba0ddbeab1601e3 input=a9049054013a1b77]*/

Generated by: LCOV version 1.14