Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Objects/clinic/descrobject.c.h
Line
Count
Source (jump to first uncovered line)
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
99
{
74
99
    int return_value = -1;
75
99
    static const char * const _keywords[] = {"fget", "fset", "fdel", "doc", NULL};
76
99
    static _PyArg_Parser _parser = {NULL, _keywords, "property", 0};
77
99
    PyObject *argsbuf[4];
78
99
    PyObject * const *fastargs;
79
99
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
80
99
    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
81
99
    PyObject *fget = NULL;
82
99
    PyObject *fset = NULL;
83
99
    PyObject *fdel = NULL;
84
99
    PyObject *doc = NULL;
85
86
99
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 4, 0, argsbuf);
87
99
    if (!fastargs) {
88
0
        goto exit;
89
0
    }
90
99
    if (!noptargs) {
91
0
        goto skip_optional_pos;
92
0
    }
93
99
    if (fastargs[0]) {
94
99
        fget = fastargs[0];
95
99
        if (!--noptargs) {
96
66
            goto skip_optional_pos;
97
66
        }
98
99
    }
99
33
    if (fastargs[1]) {
100
33
        fset = fastargs[1];
101
33
        if (!--noptargs) {
102
1
            goto skip_optional_pos;
103
1
        }
104
33
    }
105
32
    if (fastargs[2]) {
106
32
        fdel = fastargs[2];
107
32
        if (!--noptargs) {
108
0
            goto skip_optional_pos;
109
0
        }
110
32
    }
111
32
    doc = fastargs[3];
112
99
skip_optional_pos:
113
99
    return_value = property_init_impl((propertyobject *)self, fget, fset, fdel, doc);
114
115
99
exit:
116
99
    return return_value;
117
99
}
118
/*[clinic end generated code: output=916624e717862abc input=a9049054013a1b77]*/