Coverage Report

Created: 2026-10-17 06:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Python/clinic/hamt.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_modsupport.h"    // _PyArg_CheckPositional()
6
7
PyDoc_STRVAR(hamt_set__doc__,
8
"set($self, key, val, /)\n"
9
"--\n"
10
"\n"
11
"Return a copy of the mapping with the key set to the value.");
12
13
#define HAMT_SET_METHODDEF    \
14
    {"set", _PyCFunction_CAST(hamt_set), METH_FASTCALL, hamt_set__doc__},
15
16
static PyObject *
17
hamt_set_impl(PyHamtObject *self, PyObject *key, PyObject *val);
18
19
static PyObject *
20
hamt_set(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
21
0
{
22
0
    PyObject *return_value = NULL;
23
0
    PyObject *key;
24
0
    PyObject *val;
25
26
0
    if (!_PyArg_CheckPositional("set", nargs, 2, 2)) {
27
0
        goto exit;
28
0
    }
29
0
    key = args[0];
30
0
    val = args[1];
31
0
    return_value = hamt_set_impl((PyHamtObject *)self, key, val);
32
33
0
exit:
34
0
    return return_value;
35
0
}
36
37
PyDoc_STRVAR(hamt_get__doc__,
38
"get($self, key, default=None, /)\n"
39
"--\n"
40
"\n"
41
"Return the value for the key, or the default if it is not found.");
42
43
#define HAMT_GET_METHODDEF    \
44
    {"get", _PyCFunction_CAST(hamt_get), METH_FASTCALL, hamt_get__doc__},
45
46
static PyObject *
47
hamt_get_impl(PyHamtObject *self, PyObject *key, PyObject *def);
48
49
static PyObject *
50
hamt_get(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
51
0
{
52
0
    PyObject *return_value = NULL;
53
0
    PyObject *key;
54
0
    PyObject *def = Py_None;
55
56
0
    if (!_PyArg_CheckPositional("get", nargs, 1, 2)) {
57
0
        goto exit;
58
0
    }
59
0
    key = args[0];
60
0
    if (nargs < 2) {
61
0
        goto skip_optional;
62
0
    }
63
0
    def = args[1];
64
0
skip_optional:
65
0
    return_value = hamt_get_impl((PyHamtObject *)self, key, def);
66
67
0
exit:
68
0
    return return_value;
69
0
}
70
/*[clinic end generated code: output=2531b93a9a37546f input=a9049054013a1b77]*/