cpython/Objects/classobject.c

/* Class object implementation (dead now except for methods) */

#include "Python.h"
#include "pycore_call.h"          // _PyObject_VectorcallTstate()
#include "pycore_ceval.h"         // _PyEval_GetBuiltin()
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"       // _PyThreadState_GET()


#include "clinic/classobject.c.h"

#define _PyMethodObject_CAST(op)
#define TP_DESCR_GET(t)

/*[clinic input]
class method "PyMethodObject *" "&PyMethod_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b16e47edf6107c23]*/


PyObject *
PyMethod_Function(PyObject *im)
{}

PyObject *
PyMethod_Self(PyObject *im)
{}


static PyObject *
method_vectorcall(PyObject *method, PyObject *const *args,
                  size_t nargsf, PyObject *kwnames)
{}


/* Method objects are used for bound instance methods returned by
   instancename.methodname. ClassName.methodname returns an ordinary
   function.
*/

PyObject *
PyMethod_New(PyObject *func, PyObject *self)
{}

/*[clinic input]
method.__reduce__
[clinic start generated code]*/

static PyObject *
method___reduce___impl(PyMethodObject *self)
/*[clinic end generated code: output=6c04506d0fa6fdcb input=143a0bf5e96de6e8]*/
{}

static PyMethodDef method_methods[] =;

/* Descriptors for PyMethod attributes */

/* im_func and im_self are stored in the PyMethod object */

#define MO_OFF(x)

static PyMemberDef method_memberlist[] =;

/* Christian Tismer argued convincingly that method attributes should
   (nearly) always override function attributes.
   The one exception is __doc__; there's a default __doc__ which
   should only be used for the class, not for instances */

static PyObject *
method_get_doc(PyObject *self, void *context)
{}

static PyGetSetDef method_getset[] =;

static PyObject *
method_getattro(PyObject *obj, PyObject *name)
{}

/*[clinic input]
@classmethod
method.__new__ as method_new
    function: object
    instance: object
    /

Create a bound instance method object.
[clinic start generated code]*/

static PyObject *
method_new_impl(PyTypeObject *type, PyObject *function, PyObject *instance)
/*[clinic end generated code: output=d33ef4ebf702e1f7 input=4e32facc3c3108ae]*/
{}

static void
method_dealloc(PyObject *self)
{}

static PyObject *
method_richcompare(PyObject *self, PyObject *other, int op)
{}

static PyObject *
method_repr(PyObject *op)
{}

static Py_hash_t
method_hash(PyObject *self)
{}

static int
method_traverse(PyObject *self, visitproc visit, void *arg)
{}

static PyObject *
method_descr_get(PyObject *meth, PyObject *obj, PyObject *cls)
{}

PyTypeObject PyMethod_Type =;

/* ------------------------------------------------------------------------
 * instance method
 */

/*[clinic input]
class instancemethod "PyInstanceMethodObject *" "&PyInstanceMethod_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=28c9762a9016f4d2]*/

PyObject *
PyInstanceMethod_New(PyObject *func) {}

PyObject *
PyInstanceMethod_Function(PyObject *im)
{}

#define IMO_OFF(x)

static PyMemberDef instancemethod_memberlist[] =;

static PyObject *
instancemethod_get_doc(PyObject *self, void *context)
{}

static PyGetSetDef instancemethod_getset[] =;

static PyObject *
instancemethod_getattro(PyObject *self, PyObject *name)
{}

static void
instancemethod_dealloc(PyObject *self) {}

static int
instancemethod_traverse(PyObject *self, visitproc visit, void *arg) {}

static PyObject *
instancemethod_call(PyObject *self, PyObject *arg, PyObject *kw)
{}

static PyObject *
instancemethod_descr_get(PyObject *descr, PyObject *obj, PyObject *type) {}

static PyObject *
instancemethod_richcompare(PyObject *self, PyObject *other, int op)
{}

static PyObject *
instancemethod_repr(PyObject *self)
{}

/*[clinic input]
@classmethod
instancemethod.__new__ as instancemethod_new
    function: object
    /

Bind a function to a class.
[clinic start generated code]*/

static PyObject *
instancemethod_new_impl(PyTypeObject *type, PyObject *function)
/*[clinic end generated code: output=5e0397b2bdb750be input=cfc54e8b973664a8]*/
{}

PyTypeObject PyInstanceMethod_Type =;