Coverage Report

Created: 2025-07-04 06:49

/src/cpython/Objects/clinic/classobject.c.h
Line
Count
Source (jump to first uncovered line)
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_modsupport.h"    // _PyArg_CheckPositional()
6
7
PyDoc_STRVAR(method___reduce____doc__,
8
"__reduce__($self, /)\n"
9
"--\n"
10
"\n");
11
12
#define METHOD___REDUCE___METHODDEF    \
13
    {"__reduce__", (PyCFunction)method___reduce__, METH_NOARGS, method___reduce____doc__},
14
15
static PyObject *
16
method___reduce___impl(PyMethodObject *self);
17
18
static PyObject *
19
method___reduce__(PyObject *self, PyObject *Py_UNUSED(ignored))
20
0
{
21
0
    return method___reduce___impl((PyMethodObject *)self);
22
0
}
23
24
PyDoc_STRVAR(method_new__doc__,
25
"method(function, instance, /)\n"
26
"--\n"
27
"\n"
28
"Create a bound instance method object.");
29
30
static PyObject *
31
method_new_impl(PyTypeObject *type, PyObject *function, PyObject *instance);
32
33
static PyObject *
34
method_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
35
0
{
36
0
    PyObject *return_value = NULL;
37
0
    PyTypeObject *base_tp = &PyMethod_Type;
38
0
    PyObject *function;
39
0
    PyObject *instance;
40
41
0
    if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
42
0
        !_PyArg_NoKeywords("method", kwargs)) {
43
0
        goto exit;
44
0
    }
45
0
    if (!_PyArg_CheckPositional("method", PyTuple_GET_SIZE(args), 2, 2)) {
46
0
        goto exit;
47
0
    }
48
0
    function = PyTuple_GET_ITEM(args, 0);
49
0
    instance = PyTuple_GET_ITEM(args, 1);
50
0
    return_value = method_new_impl(type, function, instance);
51
52
0
exit:
53
0
    return return_value;
54
0
}
55
56
PyDoc_STRVAR(instancemethod_new__doc__,
57
"instancemethod(function, /)\n"
58
"--\n"
59
"\n"
60
"Bind a function to a class.");
61
62
static PyObject *
63
instancemethod_new_impl(PyTypeObject *type, PyObject *function);
64
65
static PyObject *
66
instancemethod_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
67
0
{
68
0
    PyObject *return_value = NULL;
69
0
    PyTypeObject *base_tp = &PyInstanceMethod_Type;
70
0
    PyObject *function;
71
72
0
    if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
73
0
        !_PyArg_NoKeywords("instancemethod", kwargs)) {
74
0
        goto exit;
75
0
    }
76
0
    if (!_PyArg_CheckPositional("instancemethod", PyTuple_GET_SIZE(args), 1, 1)) {
77
0
        goto exit;
78
0
    }
79
0
    function = PyTuple_GET_ITEM(args, 0);
80
0
    return_value = instancemethod_new_impl(type, function);
81
82
0
exit:
83
0
    return return_value;
84
0
}
85
/*[clinic end generated code: output=ab546abf90aac94e input=a9049054013a1b77]*/