1/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_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)(void(*)(void))_collections__count_elements, METH_FASTCALL, _collections__count_elements__doc__},
13
14static PyObject *
15_collections__count_elements_impl(PyObject *module, PyObject *mapping,
16 PyObject *iterable);
17
18static 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
32exit:
33 return return_value;
34}
35
36static PyObject *
37tuplegetter_new_impl(PyTypeObject *type, Py_ssize_t index, PyObject *doc);
38
39static PyObject *
40tuplegetter_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 !_PyArg_NoKeywords("_tuplegetter", kwargs)) {
48 goto exit;
49 }
50 if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) {
51 goto exit;
52 }
53 {
54 Py_ssize_t ival = -1;
55 PyObject *iobj = _PyNumber_Index(PyTuple_GET_ITEM(args, 0));
56 if (iobj != NULL) {
57 ival = PyLong_AsSsize_t(iobj);
58 Py_DECREF(iobj);
59 }
60 if (ival == -1 && PyErr_Occurred()) {
61 goto exit;
62 }
63 index = ival;
64 }
65 doc = PyTuple_GET_ITEM(args, 1);
66 return_value = tuplegetter_new_impl(type, index, doc);
67
68exit:
69 return return_value;
70}
71/*[clinic end generated code: output=947186d369f50f1e input=a9049054013a1b77]*/
72