~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Include/classobject.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

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