annotate Include/pystate.h @ 27998:e27f58a50737 legacy-trunk

SF bug #690377: Dud footnote reference in distutils docs
author Raymond Hettinger <python@rcn.com>
date Fri, 21 Feb 2003 02:47:09 +0000
parents 4b99a701defe
children 850626d47574
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Thread and interpreter state structures and their interfaces */
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
5 #ifndef Py_PYSTATE_H
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
6 #define Py_PYSTATE_H
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
7 #ifdef __cplusplus
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
8 extern "C" {
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
9 #endif
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
10
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 /* State shared between threads */
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
5919
5da18e002b1a Mass checkin (more to follow for other directories).
Guido van Rossum <guido@python.org>
parents: 5564
diff changeset
13 struct _ts; /* Forward */
5da18e002b1a Mass checkin (more to follow for other directories).
Guido van Rossum <guido@python.org>
parents: 5564
diff changeset
14 struct _is; /* Forward */
5da18e002b1a Mass checkin (more to follow for other directories).
Guido van Rossum <guido@python.org>
parents: 5564
diff changeset
15
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 typedef struct _is {
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
17
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
18 struct _is *next;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
19 struct _ts *tstate_head;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
21 PyObject *modules;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
22 PyObject *sysdict;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
23 PyObject *builtins;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
24
18689
064de84385ca Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.
Martin v. Löwis <martin@v.loewis.de>
parents: 18374
diff changeset
25 #ifdef HAVE_DLOPEN
064de84385ca Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.
Martin v. Löwis <martin@v.loewis.de>
parents: 18374
diff changeset
26 int dlopenflags;
064de84385ca Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.
Martin v. Löwis <martin@v.loewis.de>
parents: 18374
diff changeset
27 #endif
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
28
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 } PyInterpreterState;
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
30
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
31
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 /* State unique per thread */
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
33
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 struct _frame; /* Avoid including frameobject.h */
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
35
18325
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
36 /* Py_tracefunc return -1 when raising an exception, or 0 for success. */
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
37 typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
38
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
39 /* The following values are used for 'what' for tracefunc functions: */
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
40 #define PyTrace_CALL 0
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
41 #define PyTrace_EXCEPTION 1
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
42 #define PyTrace_LINE 2
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
43 #define PyTrace_RETURN 3
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
44
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 typedef struct _ts {
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
47 struct _ts *next;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
48 PyInterpreterState *interp;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
49
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
50 struct _frame *frame;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
51 int recursion_depth;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
52 int tracing;
18374
3b295ce2705f This change adjusts the profiling/tracing support so that the common
Fred Drake <fdrake@acm.org>
parents: 18325
diff changeset
53 int use_tracing;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
54
18325
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
55 Py_tracefunc c_profilefunc;
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
56 Py_tracefunc c_tracefunc;
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
57 PyObject *c_profileobj;
fb35b3a22604 Revise the interface to the profiling and tracing support for the
Fred Drake <fdrake@acm.org>
parents: 16139
diff changeset
58 PyObject *c_traceobj;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
59
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
60 PyObject *curexc_type;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
61 PyObject *curexc_value;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
62 PyObject *curexc_traceback;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
63
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
64 PyObject *exc_type;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
65 PyObject *exc_value;
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
66 PyObject *exc_traceback;
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
67
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
68 PyObject *dict;
8043
b8e8ace79cf0 Move 'dict' struct member to end of struct. This ensures binary
Guido van Rossum <guido@python.org>
parents: 7971
diff changeset
69
26109
e61b946474df Assorted patches from Armin Rigo:
Michael W. Hudson <mwh@python.net>
parents: 25108
diff changeset
70 int tick_counter;
e61b946474df Assorted patches from Armin Rigo:
Michael W. Hudson <mwh@python.net>
parents: 25108
diff changeset
71
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
72 /* XXX signal handlers should also be here */
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
73
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 } PyThreadState;
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
75
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
76
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
77 PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
78 PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
79 PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
80
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
81 PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
82 PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
83 PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
16139
d96ce9708c00 Add a new API, PyThreadState_DeleteCurrent() that combines
Guido van Rossum <guido@python.org>
parents: 14375
diff changeset
84 #ifdef WITH_THREAD
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
85 PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
16139
d96ce9708c00 Add a new API, PyThreadState_DeleteCurrent() that combines
Guido van Rossum <guido@python.org>
parents: 14375
diff changeset
86 #endif
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
87
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
88 PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
89 PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
90 PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
91
9668
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
92
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
93 /* Variable and macro for in-line access to current thread state */
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
94
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
95 PyAPI_DATA(PyThreadState *) _PyThreadState_Current;
9668
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
96
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
97 #ifdef Py_DEBUG
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
98 #define PyThreadState_GET() PyThreadState_Get()
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
99 #else
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
100 #define PyThreadState_GET() (_PyThreadState_Current)
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
101 #endif
40858ab23568 Add macro version of PyThreadState_GET(). This uses
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
102
18733
b0329649b8cf Add a low-level API to access interpreters, for David Beazley.
Guido van Rossum <guido@python.org>
parents: 18689
diff changeset
103 /* Routines for advanced debuggers, requested by David Beazley.
b0329649b8cf Add a low-level API to access interpreters, for David Beazley.
Guido van Rossum <guido@python.org>
parents: 18689
diff changeset
104 Don't use unless you know what you are doing! */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
105 PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
106 PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
107 PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 18733
diff changeset
108 PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
18733
b0329649b8cf Add a low-level API to access interpreters, for David Beazley.
Guido van Rossum <guido@python.org>
parents: 18689
diff changeset
109
27978
4b99a701defe - PyEval_GetFrame() is now declared to return a PyFrameObject *
Guido van Rossum <guido@python.org>
parents: 26109
diff changeset
110 typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
4b99a701defe - PyEval_GetFrame() is now declared to return a PyFrameObject *
Guido van Rossum <guido@python.org>
parents: 26109
diff changeset
111
26109
e61b946474df Assorted patches from Armin Rigo:
Michael W. Hudson <mwh@python.net>
parents: 25108
diff changeset
112 /* hook for PyEval_GetFrame(), requested for Psyco */
27978
4b99a701defe - PyEval_GetFrame() is now declared to return a PyFrameObject *
Guido van Rossum <guido@python.org>
parents: 26109
diff changeset
113 PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame;
26109
e61b946474df Assorted patches from Armin Rigo:
Michael W. Hudson <mwh@python.net>
parents: 25108
diff changeset
114
5405
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
115 #ifdef __cplusplus
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
116 }
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
117 #endif
b7871ca930ad Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
diff changeset
118 #endif /* !Py_PYSTATE_H */