Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Modules/clinic/_collectionsmodule.c.h
Line
Count
Source (jump to first uncovered line)
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)(void(*)(void))_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
0
{
21
0
    PyObject *return_value = NULL;
22
0
    PyObject *mapping;
23
0
    PyObject *iterable;
24
25
0
    if (!_PyArg_CheckPositional("_count_elements", nargs, 2, 2)) {
26
0
        goto exit;
27
0
    }
28
0
    mapping = args[0];
29
0
    iterable = args[1];
30
0
    return_value = _collections__count_elements_impl(module, mapping, iterable);
31
32
0
exit:
33
0
    return return_value;
34
0
}
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
9
{
42
9
    PyObject *return_value = NULL;
43
9
    Py_ssize_t index;
44
9
    PyObject *doc;
45
46
9
    if ((type == &tuplegetter_type) &&
47
9
        !_PyArg_NoKeywords("_tuplegetter", kwargs)) {
48
0
        goto exit;
49
0
    }
50
9
    if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) {
51
0
        goto exit;
52
0
    }
53
9
    if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
54
0
        PyErr_SetString(PyExc_TypeError,
55
0
                        "integer argument expected, got float" );
56
0
        goto exit;
57
0
    }
58
9
    {
59
9
        Py_ssize_t ival = -1;
60
9
        PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 0));
61
9
        if (iobj != NULL) {
62
9
            ival = PyLong_AsSsize_t(iobj);
63
9
            Py_DECREF(iobj);
64
9
        }
65
9
        if (ival == -1 && PyErr_Occurred()) {
66
0
            goto exit;
67
0
        }
68
9
        index = ival;
69
9
    }
70
9
    doc = PyTuple_GET_ITEM(args, 1);
71
9
    return_value = tuplegetter_new_impl(type, index, doc);
72
73
9
exit:
74
9
    return return_value;
75
9
}
76
/*[clinic end generated code: output=9d2bfcc9df5faf35 input=a9049054013a1b77]*/