File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ typedef struct {
5656 PyObject * in_dict ; /* A dictionary */
5757} PyInstanceObject ;
5858
59+ typedef struct {
60+ PyObject_HEAD
61+ PyObject * im_func ; /* The callable object implementing the method */
62+ PyObject * im_self ; /* The instance it is bound to, or NULL */
63+ PyObject * im_class ; /* The class that defined the method */
64+ } PyMethodObject ;
65+
5966extern DL_IMPORT (PyTypeObject ) PyClass_Type , PyInstance_Type , PyMethod_Type ;
6067
6168#define PyClass_Check (op ) ((op)->ob_type == &PyClass_Type)
@@ -70,6 +77,15 @@ extern PyObject *PyMethod_Function Py_PROTO((PyObject *));
7077extern PyObject * PyMethod_Self Py_PROTO ((PyObject * ) );
7178extern PyObject * PyMethod_Class Py_PROTO ((PyObject * ) );
7279
80+ /* Macros for direct access to these values. Type checks are *not*
81+ done, so use with care. */
82+ #define PyMethod_GET_FUNCTION (meth ) \
83+ (((PyMethodObject *)meth) -> im_func)
84+ #define PyMethod_GET_SELF (meth ) \
85+ (((PyMethodObject *)meth) -> im_self)
86+ #define PyMethod_GET_CLASS (meth ) \
87+ (((PyMethodObject *)meth) -> im_class)
88+
7389extern int PyClass_IsSubclass Py_PROTO ((PyObject * , PyObject * ) );
7490
7591extern PyObject * PyInstance_DoBinOp
Original file line number Diff line number Diff line change @@ -1411,14 +1411,6 @@ PyTypeObject PyInstance_Type = {
14111411 In case (b), im_self is NULL
14121412*/
14131413
1414- typedef struct {
1415- PyObject_HEAD
1416- PyObject * im_func ; /* The function implementing the method */
1417- PyObject * im_self ; /* The instance it is bound to, or NULL */
1418- PyObject * im_class ; /* The class that defined the method */
1419- } PyMethodObject ;
1420-
1421-
14221414static PyMethodObject * free_list ;
14231415
14241416PyObject *
You can’t perform that action at this time.
0 commit comments