Mercurial > cpython-lru_cache-weakref
annotate Include/classobject.h @ 17581:c1937faabb23 2.1
Added support for optional explanation parameter to the \versionadded
macro.
Refactored do_cmd_versionadded() and do_cmd_versionchanged() to do most
of the work in a helper function, with the do_cmd_*() wrappers just supplying
a portion of the replacement text.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Wed, 18 Apr 2001 17:29:14 +0000 |
| parents | d807488dfc7a |
| children | 09df3254b49d |
| rev | line source |
|---|---|
| 145 | 1 |
| 6 | 2 /* Class object interface */ |
| 3 | |
|
1290
7971fecbf28e
* Lots of small changes related to access.
Guido van Rossum <guido@python.org>
parents:
1289
diff
changeset
|
4 /* Revealing some structures (not for general use) */ |
| 6 | 5 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
6 #ifndef Py_CLASSOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
7 #define Py_CLASSOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
8 #ifdef __cplusplus |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
9 extern "C" { |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
10 #endif |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
11 |
|
1289
4d292c7857d4
Access checks now work, at least for instance data (not for methods
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
12 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
13 PyObject_HEAD |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
14 PyObject *cl_bases; /* A tuple of class objects */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
15 PyObject *cl_dict; /* A dictionary */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
16 PyObject *cl_name; /* A string */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
17 /* The following three are functions or NULL */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
18 PyObject *cl_getattr; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
19 PyObject *cl_setattr; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
20 PyObject *cl_delattr; |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2074
diff
changeset
|
21 } PyClassObject; |
|
1289
4d292c7857d4
Access checks now work, at least for instance data (not for methods
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
22 |
|
1290
7971fecbf28e
* Lots of small changes related to access.
Guido van Rossum <guido@python.org>
parents:
1289
diff
changeset
|
23 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
24 PyObject_HEAD |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
25 PyClassObject *in_class; /* The class object */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
26 PyObject *in_dict; /* A dictionary */ |
|
16385
1fb6672b20ef
PEP 205, Weak References -- initial checkin.
Fred Drake <fdrake@acm.org>
parents:
16313
diff
changeset
|
27 PyObject *in_weakreflist; /* List of weak references */ |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2074
diff
changeset
|
28 } PyInstanceObject; |
|
1290
7971fecbf28e
* Lots of small changes related to access.
Guido van Rossum <guido@python.org>
parents:
1289
diff
changeset
|
29 |
|
8657
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
30 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
31 PyObject_HEAD |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
32 PyObject *im_func; /* The callable object implementing the method */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
33 PyObject *im_self; /* The instance it is bound to, or NULL */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
34 PyObject *im_class; /* The class that defined the method */ |
|
17169
d807488dfc7a
Add the necessary field for weak reference support to the function and
Fred Drake <fdrake@acm.org>
parents:
16385
diff
changeset
|
35 PyObject *im_weakreflist; /* List of weak references */ |
|
8657
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
36 } PyMethodObject; |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
37 |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2197
diff
changeset
|
38 extern DL_IMPORT(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; |
| 6 | 39 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2074
diff
changeset
|
40 #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2074
diff
changeset
|
41 #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2074
diff
changeset
|
42 #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) |
| 6 | 43 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
44 extern DL_IMPORT(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
45 extern DL_IMPORT(PyObject *) PyInstance_New(PyObject *, PyObject *, |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
46 PyObject *); |
|
16313
662adf03e4fa
Added prototype for PyInstance_NewRaw().
Fred Drake <fdrake@acm.org>
parents:
15715
diff
changeset
|
47 extern DL_IMPORT(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
48 extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); |
| 6 | 49 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
50 extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *); |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
51 extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *); |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
52 extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *); |
|
944
222f04f55083
Changes so that user-defined classes can implement operations invoked
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
53 |
|
8657
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
54 /* Macros for direct access to these values. Type checks are *not* |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
55 done, so use with care. */ |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
56 #define PyMethod_GET_FUNCTION(meth) \ |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
57 (((PyMethodObject *)meth) -> im_func) |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
58 #define PyMethod_GET_SELF(meth) \ |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
59 (((PyMethodObject *)meth) -> im_self) |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
60 #define PyMethod_GET_CLASS(meth) \ |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
61 (((PyMethodObject *)meth) -> im_class) |
|
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
62 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
63 extern DL_IMPORT(int) PyClass_IsSubclass(PyObject *, PyObject *); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
64 |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
13444
diff
changeset
|
65 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
66 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
67 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
68 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
69 #endif /* !Py_CLASSOBJECT_H */ |
