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
;
30 /* State unique per thread */
32 struct _frame
; /* Avoid including frameobject.h */
34 /* Py_tracefunc return -1 when raising an exception, or 0 for success. */
35 typedef int (*Py_tracefunc
)(PyObject
*, struct _frame
*, int, PyObject
*);
37 /* The following values are used for 'what' for tracefunc functions: */
38 #define PyTrace_CALL 0
39 #define PyTrace_EXCEPTION 1
40 #define PyTrace_LINE 2
41 #define PyTrace_RETURN 3
46 PyInterpreterState
*interp
;
54 Py_tracefunc c_profilefunc
;
55 Py_tracefunc c_tracefunc
;
56 PyObject
*c_profileobj
;
59 PyObject
*curexc_type
;
60 PyObject
*curexc_value
;
61 PyObject
*curexc_traceback
;
65 PyObject
*exc_traceback
;
69 /* XXX signal handlers should also be here */
74 DL_IMPORT(PyInterpreterState
*) PyInterpreterState_New(void);
75 DL_IMPORT(void) PyInterpreterState_Clear(PyInterpreterState
*);
76 DL_IMPORT(void) PyInterpreterState_Delete(PyInterpreterState
*);
78 DL_IMPORT(PyThreadState
*) PyThreadState_New(PyInterpreterState
*);
79 DL_IMPORT(void) PyThreadState_Clear(PyThreadState
*);
80 DL_IMPORT(void) PyThreadState_Delete(PyThreadState
*);
82 DL_IMPORT(void) PyThreadState_DeleteCurrent(void);
85 DL_IMPORT(PyThreadState
*) PyThreadState_Get(void);
86 DL_IMPORT(PyThreadState
*) PyThreadState_Swap(PyThreadState
*);
87 DL_IMPORT(PyObject
*) PyThreadState_GetDict(void);
90 /* Variable and macro for in-line access to current thread state */
92 extern DL_IMPORT(PyThreadState
*) _PyThreadState_Current
;
95 #define PyThreadState_GET() PyThreadState_Get()
97 #define PyThreadState_GET() (_PyThreadState_Current)
103 #endif /* !Py_PYSTATE_H */