2 /* Thread and interpreter state structures and their interfaces */
11 /* State shared between threads */
13 struct _ts
; /* Forward */
14 struct _is
; /* Forward */
19 struct _ts
*tstate_head
;
32 /* State unique per thread */
34 struct _frame
; /* Avoid including frameobject.h */
36 /* Py_tracefunc return -1 when raising an exception, or 0 for success. */
37 typedef int (*Py_tracefunc
)(PyObject
*, struct _frame
*, int, PyObject
*);
39 /* The following values are used for 'what' for tracefunc functions: */
40 #define PyTrace_CALL 0
41 #define PyTrace_EXCEPTION 1
42 #define PyTrace_LINE 2
43 #define PyTrace_RETURN 3
48 PyInterpreterState
*interp
;
55 Py_tracefunc c_profilefunc
;
56 Py_tracefunc c_tracefunc
;
57 PyObject
*c_profileobj
;
60 PyObject
*curexc_type
;
61 PyObject
*curexc_value
;
62 PyObject
*curexc_traceback
;
66 PyObject
*exc_traceback
;
70 /* XXX signal handlers should also be here */
75 PyAPI_FUNC(PyInterpreterState
*) PyInterpreterState_New(void);
76 PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState
*);
77 PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState
*);
79 PyAPI_FUNC(PyThreadState
*) PyThreadState_New(PyInterpreterState
*);
80 PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState
*);
81 PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState
*);
83 PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
86 PyAPI_FUNC(PyThreadState
*) PyThreadState_Get(void);
87 PyAPI_FUNC(PyThreadState
*) PyThreadState_Swap(PyThreadState
*);
88 PyAPI_FUNC(PyObject
*) PyThreadState_GetDict(void);
91 /* Variable and macro for in-line access to current thread state */
93 PyAPI_DATA(PyThreadState
*) _PyThreadState_Current
;
96 #define PyThreadState_GET() PyThreadState_Get()
98 #define PyThreadState_GET() (_PyThreadState_Current)
101 /* Routines for advanced debuggers, requested by David Beazley.
102 Don't use unless you know what you are doing! */
103 PyAPI_FUNC(PyInterpreterState
*) PyInterpreterState_Head(void);
104 PyAPI_FUNC(PyInterpreterState
*) PyInterpreterState_Next(PyInterpreterState
*);
105 PyAPI_FUNC(PyThreadState
*) PyInterpreterState_ThreadHead(PyInterpreterState
*);
106 PyAPI_FUNC(PyThreadState
*) PyThreadState_Next(PyThreadState
*);
111 #endif /* !Py_PYSTATE_H */