File: /Users/paulross/dev/Python-3.6.2/Include/classobject.h

Green shading in the line number column means the source is part of the translation unit, red means it is conditionally excluded. Highlighted line numbers link to the translation unit page. Highlighted macros link to the macro page.

       1: /* Former class object interface -- now only bound methods are here  */
       2: 
       3: /* Revealing some structures (not for general use) */
       4: 
       5: #ifndef Py_LIMITED_API
       6: #ifndef Py_CLASSOBJECT_H
       7: #define Py_CLASSOBJECT_H
       8: #ifdef __cplusplus
       9: extern "C" {
      10: #endif
      11: 
      12: typedef struct {
      13:     PyObject_HEAD
      14:     PyObject *im_func;   /* The callable object implementing the method */
      15:     PyObject *im_self;   /* The instance it is bound to */
      16:     PyObject *im_weakreflist; /* List of weak references */
      17: } PyMethodObject;
      18: 
      19: PyAPI_DATA(PyTypeObject) PyMethod_Type;
      20: 
      21: #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
      22: 
      23: PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
      24: 
      25: PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
      26: PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
      27: 
      28: /* Macros for direct access to these values. Type checks are *not*
      29:    done, so use with care. */
      30: #define PyMethod_GET_FUNCTION(meth) \
      31:         (((PyMethodObject *)meth) -> im_func)
      32: #define PyMethod_GET_SELF(meth) \
      33:     (((PyMethodObject *)meth) -> im_self)
      34: 
      35: PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
      36: 
      37: typedef struct {
      38:     PyObject_HEAD
      39:     PyObject *func;
      40: } PyInstanceMethodObject;
      41: 
      42: PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
      43: 
      44: #define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
      45: 
      46: PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
      47: PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
      48: 
      49: /* Macros for direct access to these values. Type checks are *not*
      50:    done, so use with care. */
      51: #define PyInstanceMethod_GET_FUNCTION(meth) \
      52:         (((PyInstanceMethodObject *)meth) -> func)
      53: 
      54: #ifdef __cplusplus
      55: }
      56: #endif
      57: #endif /* !Py_CLASSOBJECT_H */
      58: #endif /* Py_LIMITED_API */
      59: