Coverage Report

Created: 2026-06-14 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Python-3.8.3/Objects/clinic/descrobject.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
static PyObject *
6
mappingproxy_new_impl(PyTypeObject *type, PyObject *mapping);
7
8
static PyObject *
9
mappingproxy_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
10
1
{
11
1
    PyObject *return_value = NULL;
12
1
    static const char * const _keywords[] = {"mapping", NULL};
13
1
    static _PyArg_Parser _parser = {NULL, _keywords, "mappingproxy", 0};
14
1
    PyObject *argsbuf[1];
15
1
    PyObject * const *fastargs;
16
1
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
17
1
    PyObject *mapping;
18
19
1
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
20
1
    if (!fastargs) {
21
0
        goto exit;
22
0
    }
23
1
    mapping = fastargs[0];
24
1
    return_value = mappingproxy_new_impl(type, mapping);
25
26
1
exit:
27
1
    return return_value;
28
1
}
29
30
PyDoc_STRVAR(property_init__doc__,
31
"property(fget=None, fset=None, fdel=None, doc=None)\n"
32
"--\n"
33
"\n"
34
"Property attribute.\n"
35
"\n"
36
"  fget\n"
37
"    function to be used for getting an attribute value\n"
38
"  fset\n"
39
"    function to be used for setting an attribute value\n"
40
"  fdel\n"
41
"    function to be used for del\'ing an attribute\n"
42
"  doc\n"
43
"    docstring\n"
44
"\n"
45
"Typical use is to define a managed attribute x:\n"
46
"\n"
47
"class C(object):\n"
48
"    def getx(self): return self._x\n"
49
"    def setx(self, value): self._x = value\n"
50
"    def delx(self): del self._x\n"
51
"    x = property(getx, setx, delx, \"I\'m the \'x\' property.\")\n"
52
"\n"
53
"Decorators make defining new properties or modifying existing ones easy:\n"
54
"\n"
55
"class C(object):\n"
56
"    @property\n"
57
"    def x(self):\n"
58
"        \"I am the \'x\' property.\"\n"
59
"        return self._x\n"
60
"    @x.setter\n"
61
"    def x(self, value):\n"
62
"        self._x = value\n"
63
"    @x.deleter\n"
64
"    def x(self):\n"
65
"        del self._x");
66
67
static int
68
property_init_impl(propertyobject *self, PyObject *fget, PyObject *fset,
69
                   PyObject *fdel, PyObject *doc);
70
71
static int
72
property_init(PyObject *self, PyObject *args, PyObject *kwargs)
73
94
{
74
94
    int return_value = -1;
75
94
    static const char * const _keywords[] = {"fget", "fset", "fdel", "doc", NULL};
76
94
    static _PyArg_Parser _parser = {NULL, _keywords, "property", 0};
77
94
    PyObject *argsbuf[4];
78
94
    PyObject * const *fastargs;
79
94
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
80
94
    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
81
94
    PyObject *fget = NULL;
82
94
    PyObject *fset = NULL;
83
94
    PyObject *fdel = NULL;
84
94
    PyObject *doc = NULL;
85
86
94
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 4, 0, argsbuf);
87
94
    if (!fastargs) {
88
0
        goto exit;
89
0
    }
90
94
    if (!noptargs) {
91
0
        goto skip_optional_pos;
92
0
    }
93
94
    if (fastargs[0]) {
94
94
        fget = fastargs[0];
95
94
        if (!--noptargs) {
96
63
            goto skip_optional_pos;
97
63
        }
98
94
    }
99
31
    if (fastargs[1]) {
100
31
        fset = fastargs[1];
101
31
        if (!--noptargs) {
102
1
            goto skip_optional_pos;
103
1
        }
104
31
    }
105
30
    if (fastargs[2]) {
106
30
        fdel = fastargs[2];
107
30
        if (!--noptargs) {
108
0
            goto skip_optional_pos;
109
0
        }
110
30
    }
111
30
    doc = fastargs[3];
112
94
skip_optional_pos:
113
94
    return_value = property_init_impl((propertyobject *)self, fget, fset, fdel, doc);
114
115
94
exit:
116
94
    return return_value;
117
94
}
118
/*[clinic end generated code: output=916624e717862abc input=a9049054013a1b77]*/