cinap_lenrekadd hg and python4bb9e2215 years agoHistory
2580 lines · 60.9 KB · C
RawDownload
 static PyObject *instancemethod_descr_get(PyObject *meth, PyObject *obj, PyObject *cls){	/* Don't rebind an already bound method, or an unbound method	   of a class that's not a base class of cls. */ 	if (PyMethod_GET_SELF(meth) != NULL) {		/* Already bound */		Py_INCREF(meth);		return meth;	}	/* No, it is an unbound method */	if (PyMethod_GET_CLASS(meth) != NULL && cls != NULL) {		/* Do subclass test.  If it fails, return meth unchanged. */		int ok = PyObject_IsSubclass(cls, PyMethod_GET_CLASS(meth));		if (ok < 0)			return NULL;		if (!ok) {			Py_INCREF(meth);			return meth;		}	}	/* Bind it to obj */	return PyMethod_New(PyMethod_GET_FUNCTION(meth), obj, cls);} PyTypeObject PyMethod_Type = {	PyObject_HEAD_INIT(&PyType_Type)	0,	"instancemethod",	sizeof(PyMethodObject),	0,	(destructor)instancemethod_dealloc,	/* tp_dealloc */	0,					/* tp_print */	0,					/* tp_getattr */	0,					/* tp_setattr */	(cmpfunc)instancemethod_compare,	/* tp_compare */	(reprfunc)instancemethod_repr,		/* tp_repr */	0,					/* tp_as_number */	0,					/* tp_as_sequence */	0,					/* tp_as_mapping */	(hashfunc)instancemethod_hash,		/* tp_hash */	instancemethod_call,			/* tp_call */	0,					/* tp_str */	instancemethod_getattro,		/* tp_getattro */	PyObject_GenericSetAttr,		/* tp_setattro */	0,					/* tp_as_buffer */	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC  | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */	instancemethod_doc,			/* tp_doc */	(traverseproc)instancemethod_traverse,	/* tp_traverse */	0,					/* tp_clear */	0,					/* tp_richcompare */ 	offsetof(PyMethodObject, im_weakreflist), /* tp_weaklistoffset */	0,					/* tp_iter */	0,					/* tp_iternext */	0,					/* tp_methods */	instancemethod_memberlist,		/* tp_members */	instancemethod_getset,			/* tp_getset */	0,					/* tp_base */	0,					/* tp_dict */	instancemethod_descr_get,		/* tp_descr_get */	0,					/* tp_descr_set */	0,					/* tp_dictoffset */	0,					/* tp_init */	0,					/* tp_alloc */	instancemethod_new,			/* tp_new */}; /* Clear out the free list */ voidPyMethod_Fini(void){	while (free_list) {		PyMethodObject *im = free_list;		free_list = (PyMethodObject *)(im->im_self);		PyObject_GC_Del(im);	}}

Lines 2501–2580 of 2580. Previous lines