Mercurial > cpython-lru_cache-weakref
annotate Include/classobject.h @ 49955:878d40468c4e legacy-trunk
Issue #4384: Added logging integration with warnings module using captureWarnings(). This change includes a NullHandler which does nothing; it will be of use to library developers who want to avoid the "No handlers could be found for logger XXX" message which can appear if the library user doesn't configure logging.
| author | Vinay Sajip <vinay_sajip@yahoo.co.uk> |
|---|---|
| date | Wed, 03 Dec 2008 23:22:58 +0000 |
| parents | 65ae68c7aca3 |
| children | 7b8ba019cd15 |
| 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 */ |
|
21300
f5532cc1514b
PyMethodObject(): Update the comment about im_class based upon a
Guido van Rossum <guido@python.org>
parents:
19751
diff
changeset
|
34 PyObject *im_class; /* The class that asked for 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 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
38 PyAPI_DATA(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 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
44 PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
45 PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
46 PyObject *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
47 PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
48 PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); |
| 6 | 49 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
50 PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
51 PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
52 PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); |
|
19751
3d76dfc34c57
Add PyMethod_Function(), PyMethod_Self(), PyMethod_Class() back.
Guido van Rossum <guido@python.org>
parents:
18933
diff
changeset
|
53 |
|
28519
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
54 /* Look up attribute with name (a string) on instance object pinst, using |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
55 * only the instance and base class dicts. If a descriptor is found in |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
56 * a class dict, the descriptor is returned without calling it. |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
57 * Returns NULL if nothing found, else a borrowed reference to the |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
58 * value associated with name in the dict in which name was found. |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
59 * The point of this routine is that it never calls arbitrary Python |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
60 * code, so is always "safe": all it does is dict lookups. The function |
| 28527 | 61 * can't fail, never sets an exception, and NULL is not an error (it just |
|
28519
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
62 * means "not found"). |
|
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
63 */ |
| 28527 | 64 PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); |
|
28519
2a3095a415b1
New private API function _PyInstance_Lookup. gc will use this to figure
Tim Peters <tim.peters@gmail.com>
parents:
24752
diff
changeset
|
65 |
|
8657
ac43e2246695
Move the definition of PyMethodObject to classobject.h, so it can define
Guido van Rossum <guido@python.org>
parents:
5195
diff
changeset
|
66 /* 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
|
67 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
|
68 #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
|
69 (((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
|
70 #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
|
71 (((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
|
72 #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
|
73 (((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
|
74 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21300
diff
changeset
|
75 PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
76 |
|
45341
65ae68c7aca3
Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation.
Christian Heimes <christian@cheimes.de>
parents:
28527
diff
changeset
|
77 PyAPI_FUNC(int) PyMethod_ClearFreeList(void); |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
13444
diff
changeset
|
78 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
79 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
80 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
81 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1290
diff
changeset
|
82 #endif /* !Py_CLASSOBJECT_H */ |
