Line data Source code
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 *
17 574 : method___reduce__(PyMethodObject *self, PyObject *Py_UNUSED(ignored))
18 : {
19 574 : 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 *
32 1006 : method_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
33 : {
34 1006 : PyObject *return_value = NULL;
35 : PyObject *function;
36 : PyObject *instance;
37 :
38 1006 : if ((type == &PyMethod_Type ||
39 1006 : type->tp_init == PyMethod_Type.tp_init) &&
40 0 : !_PyArg_NoKeywords("method", kwargs)) {
41 0 : goto exit;
42 : }
43 1006 : if (!_PyArg_CheckPositional("method", PyTuple_GET_SIZE(args), 2, 2)) {
44 0 : goto exit;
45 : }
46 1006 : function = PyTuple_GET_ITEM(args, 0);
47 1006 : instance = PyTuple_GET_ITEM(args, 1);
48 1006 : return_value = method_new_impl(type, function, instance);
49 :
50 1006 : exit:
51 1006 : 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 *
64 2 : instancemethod_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
65 : {
66 2 : PyObject *return_value = NULL;
67 : PyObject *function;
68 :
69 2 : if ((type == &PyInstanceMethod_Type ||
70 2 : type->tp_init == PyInstanceMethod_Type.tp_init) &&
71 0 : !_PyArg_NoKeywords("instancemethod", kwargs)) {
72 0 : goto exit;
73 : }
74 2 : if (!_PyArg_CheckPositional("instancemethod", PyTuple_GET_SIZE(args), 1, 1)) {
75 0 : goto exit;
76 : }
77 2 : function = PyTuple_GET_ITEM(args, 0);
78 2 : return_value = instancemethod_new_impl(type, function);
79 :
80 2 : exit:
81 2 : return return_value;
82 : }
83 : /*[clinic end generated code: output=a230fe125f664416 input=a9049054013a1b77]*/
|