| [3225] | 1 |
|
|---|
| 2 | /* Thread and interpreter state structures and their interfaces */
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 | #ifndef Py_PYSTATE_H
|
|---|
| 6 | #define Py_PYSTATE_H
|
|---|
| 7 | #ifdef __cplusplus
|
|---|
| 8 | extern "C" {
|
|---|
| 9 | #endif
|
|---|
| 10 |
|
|---|
| 11 | /* State shared between threads */
|
|---|
| 12 |
|
|---|
| 13 | struct _ts; /* Forward */
|
|---|
| 14 | struct _is; /* Forward */
|
|---|
| 15 |
|
|---|
| 16 | typedef struct _is {
|
|---|
| 17 |
|
|---|
| 18 | struct _is *next;
|
|---|
| 19 | struct _ts *tstate_head;
|
|---|
| 20 |
|
|---|
| 21 | PyObject *modules;
|
|---|
| 22 | PyObject *sysdict;
|
|---|
| 23 | PyObject *builtins;
|
|---|
| 24 |
|
|---|
| 25 | PyObject *codec_search_path;
|
|---|
| 26 | PyObject *codec_search_cache;
|
|---|
| 27 | PyObject *codec_error_registry;
|
|---|
| 28 |
|
|---|
| 29 | #ifdef HAVE_DLOPEN
|
|---|
| 30 | int dlopenflags;
|
|---|
| 31 | #endif
|
|---|
| 32 | #ifdef WITH_TSC
|
|---|
| 33 | int tscdump;
|
|---|
| 34 | #endif
|
|---|
| 35 |
|
|---|
| 36 | } PyInterpreterState;
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | /* State unique per thread */
|
|---|
| 40 |
|
|---|
| 41 | struct _frame; /* Avoid including frameobject.h */
|
|---|
| 42 |
|
|---|
| 43 | /* Py_tracefunc return -1 when raising an exception, or 0 for success. */
|
|---|
| 44 | typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
|
|---|
| 45 |
|
|---|
| 46 | /* The following values are used for 'what' for tracefunc functions: */
|
|---|
| 47 | #define PyTrace_CALL 0
|
|---|
| 48 | #define PyTrace_EXCEPTION 1
|
|---|
| 49 | #define PyTrace_LINE 2
|
|---|
| 50 | #define PyTrace_RETURN 3
|
|---|
| 51 | #define PyTrace_C_CALL 4
|
|---|
| 52 | #define PyTrace_C_EXCEPTION 5
|
|---|
| 53 | #define PyTrace_C_RETURN 6
|
|---|
| 54 |
|
|---|
| 55 | typedef struct _ts {
|
|---|
| 56 | /* See Python/ceval.c for comments explaining most fields */
|
|---|
| 57 |
|
|---|
| 58 | struct _ts *next;
|
|---|
| 59 | PyInterpreterState *interp;
|
|---|
| 60 |
|
|---|
| 61 | struct _frame *frame;
|
|---|
| |
|---|