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