(root)/
Python-3.11.7/
Modules/
clinic/
_collectionsmodule.c.h
       1  /*[clinic input]
       2  preserve
       3  [clinic start generated code]*/
       4  
       5  PyDoc_STRVAR(_collections__count_elements__doc__,
       6  "_count_elements($module, mapping, iterable, /)\n"
       7  "--\n"
       8  "\n"
       9  "Count elements in the iterable, updating the mapping");
      10  
      11  #define _COLLECTIONS__COUNT_ELEMENTS_METHODDEF    \
      12      {"_count_elements", _PyCFunction_CAST(_collections__count_elements), METH_FASTCALL, _collections__count_elements__doc__},
      13  
      14  static PyObject *
      15  _collections__count_elements_impl(PyObject *module, PyObject *mapping,
      16                                    PyObject *iterable);
      17  
      18  static PyObject *
      19  _collections__count_elements(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      20  {
      21      PyObject *return_value = NULL;
      22      PyObject *mapping;
      23      PyObject *iterable;
      24  
      25      if (!_PyArg_CheckPositional("_count_elements", nargs, 2, 2)) {
      26          goto exit;
      27      }
      28      mapping = args[0];
      29      iterable = args[1];
      30      return_value = _collections__count_elements_impl(module, mapping, iterable);
      31  
      32  exit:
      33      return return_value;
      34  }
      35  
      36  static PyObject *
      37  tuplegetter_new_impl(PyTypeObject *type, Py_ssize_t index, PyObject *doc);
      38  
      39  static PyObject *
      40  tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
      41  {
      42      PyObject *return_value = NULL;
      43      Py_ssize_t index;
      44      PyObject *doc;
      45  
      46      if ((type == &tuplegetter_type ||
      47           type->tp_init == tuplegetter_type.tp_init) &&
      48          !_PyArg_NoKeywords("_tuplegetter", kwargs)) {
      49          goto exit;
      50      }
      51      if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) {
      52          goto exit;
      53      }
      54      {
      55          Py_ssize_t ival = -1;
      56          PyObject *iobj = _PyNumber_Index(PyTuple_GET_ITEM(args, 0));
      57          if (iobj != NULL) {
      58              ival = PyLong_AsSsize_t(iobj);
      59              Py_DECREF(iobj);
      60          }
      61          if (ival == -1 && PyErr_Occurred()) {
      62              goto exit;
      63          }
      64          index = ival;
      65      }
      66      doc = PyTuple_GET_ITEM(args, 1);
      67      return_value = tuplegetter_new_impl(type, index, doc);
      68  
      69  exit:
      70      return return_value;
      71  }
      72  /*[clinic end generated code: output=36b0948c4676c831 input=a9049054013a1b77]*/