1/*[clinic input] 2preserve 3[clinic start generated code]*/ 4 5PyDoc_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 13static PyObject * 14method___reduce___impl(PyMethodObject *self); 15 16static PyObject * 17method___reduce__(PyMethodObject *self, PyObject *Py_UNUSED(ignored)) 18{ 19 return method___reduce___impl(self); 20} 21 22PyDoc_STRVAR(method_new__doc__, 23"method(function, instance, /)\n" 24"--\n" 25"\n" 26"Create a bound instance method object."); 27 28static PyObject * 29method_new_impl(PyTypeObject *type, PyObject *function, PyObject *instance); 30 31static PyObject * 32method_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 50exit: 51 return return_value; 52} 53 54PyDoc_STRVAR(instancemethod_new__doc__, 55"instancemethod(function, /)\n" 56"--\n" 57"\n" 58"Bind a function to a class."); 59 60static PyObject * 61instancemethod_new_impl(PyTypeObject *type, PyObject *function); 62 63static PyObject * 64instancemethod_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 80exit: 81 return return_value; 82} 83/*[clinic end generated code: output=a230fe125f664416 input=a9049054013a1b77]*/ 84