extern DL_IMPORT(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
+extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *);
+extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *);
+extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *);
+
/* Macros for direct access to these values. Type checks are *not*
done, so use with care. */
#define PyMethod_GET_FUNCTION(meth) \
return (PyObject *) op;
}
+PyObject *
+PyMethod_Function(PyObject *im)
+{
+ if (!PyMethod_Check(im)) {
+ PyErr_BadInternalCall();
+ return NULL;
+ }
+ return ((PyMethodObject *)im)->im_func;
+}
+
+PyObject *
+PyMethod_Self(PyObject *im)
+{
+ if (!PyMethod_Check(im)) {
+ PyErr_BadInternalCall();
+ return NULL;
+ }
+ return ((PyMethodObject *)im)->im_self;
+}
+
+PyObject *
+PyMethod_Class(PyObject *im)
+{
+ if (!PyMethod_Check(im)) {
+ PyErr_BadInternalCall();
+ return NULL;
+ }
+ return ((PyMethodObject *)im)->im_class;
+}
+
static PyObject *
class_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{