| #ifndef Py_CPYTHON_PYSTATE_H |
| # error "this header file must not be included directly" |
| #endif |
|
|
|
|
| |
|
|
| PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *); |
| PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int); |
|
|
| PyAPI_FUNC(PyObject *) PyUnstable_InterpreterState_GetMainModule(PyInterpreterState *); |
|
|
| |
|
|
| |
| typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *); |
|
|
| |
| |
| |
| |
| |
| #define PyTrace_CALL 0 |
| #define PyTrace_EXCEPTION 1 |
| #define PyTrace_LINE 2 |
| #define PyTrace_RETURN 3 |
| #define PyTrace_C_CALL 4 |
| #define PyTrace_C_EXCEPTION 5 |
| #define PyTrace_C_RETURN 6 |
| #define PyTrace_OPCODE 7 |
|
|
| typedef struct _err_stackitem { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| PyObject *exc_value; |
|
|
| struct _err_stackitem *previous_item; |
|
|
| } _PyErr_StackItem; |
|
|
| typedef struct _stack_chunk { |
| struct _stack_chunk *previous; |
| size_t size; |
| size_t top; |
| PyObject * data[1]; |
| } _PyStackChunk; |
|
|
| struct _ts { |
| |
|
|
| PyThreadState *prev; |
| PyThreadState *next; |
| PyInterpreterState *interp; |
|
|
| |
| |
| |
| uintptr_t eval_breaker; |
|
|
| struct { |
| |
| |
| |
| |
| unsigned int initialized:1; |
|
|
| |
| unsigned int bound:1; |
| |
| unsigned int unbound:1; |
| |
| unsigned int bound_gilstate:1; |
| |
| unsigned int active:1; |
| |
| unsigned int holds_gil:1; |
|
|
| |
| unsigned int finalizing:1; |
| unsigned int cleared:1; |
| unsigned int finalized:1; |
|
|
| |
| unsigned int :23; |
| } _status; |
| #ifdef Py_BUILD_CORE |
| # define _PyThreadState_WHENCE_NOTSET -1 |
| # define _PyThreadState_WHENCE_UNKNOWN 0 |
| # define _PyThreadState_WHENCE_INIT 1 |
| # define _PyThreadState_WHENCE_FINI 2 |
| # define _PyThreadState_WHENCE_THREADING 3 |
| # define _PyThreadState_WHENCE_GILSTATE 4 |
| # define _PyThreadState_WHENCE_EXEC 5 |
| #endif |
| int _whence; |
|
|
| |
| |
| int state; |
|
|
| int py_recursion_remaining; |
| int py_recursion_limit; |
|
|
| int c_recursion_remaining; |
| int recursion_headroom; |
|
|
| |
| |
| |
| int tracing; |
| int what_event; |
|
|
| |
| struct _PyInterpreterFrame *current_frame; |
|
|
| Py_tracefunc c_profilefunc; |
| Py_tracefunc c_tracefunc; |
| PyObject *c_profileobj; |
| PyObject *c_traceobj; |
|
|
| |
| PyObject *current_exception; |
|
|
| |
| |
| |
| _PyErr_StackItem *exc_info; |
|
|
| PyObject *dict; |
|
|
| int gilstate_counter; |
|
|
| PyObject *async_exc; |
| unsigned long thread_id; |
|
|
| |
| |
| |
| |
| unsigned long native_thread_id; |
|
|
| PyObject *delete_later; |
|
|
| |
| |
| |
| |
| |
| uintptr_t critical_section; |
|
|
| int coroutine_origin_tracking_depth; |
|
|
| PyObject *async_gen_firstiter; |
| PyObject *async_gen_finalizer; |
|
|
| PyObject *context; |
| uint64_t context_ver; |
|
|
| |
| uint64_t id; |
|
|
| _PyStackChunk *datastack_chunk; |
| PyObject **datastack_top; |
| PyObject **datastack_limit; |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| _PyErr_StackItem exc_state; |
|
|
| PyObject *previous_executor; |
|
|
| uint64_t dict_global_version; |
|
|
| |
| PyObject *threading_local_key; |
|
|
| |
| |
| |
| PyObject *threading_local_sentinel; |
| }; |
|
|
| #ifdef Py_DEBUG |
| |
| |
| # define Py_C_RECURSION_LIMIT 500 |
| #elif defined(__s390x__) |
| # define Py_C_RECURSION_LIMIT 800 |
| #elif defined(_WIN32) && defined(_M_ARM64) |
| # define Py_C_RECURSION_LIMIT 1000 |
| #elif defined(_WIN32) |
| # define Py_C_RECURSION_LIMIT 3000 |
| #elif defined(__ANDROID__) |
| |
| |
| # define Py_C_RECURSION_LIMIT 3000 |
| #elif defined(_Py_ADDRESS_SANITIZER) |
| # define Py_C_RECURSION_LIMIT 4000 |
| #elif defined(__wasi__) |
| |
| # define Py_C_RECURSION_LIMIT 5000 |
| #else |
| |
| # define Py_C_RECURSION_LIMIT 10000 |
| #endif |
|
|
|
|
| |
|
|
| |
| |
| PyAPI_FUNC(PyThreadState *) PyThreadState_GetUnchecked(void); |
|
|
| |
| #define _PyThreadState_UncheckedGet PyThreadState_GetUnchecked |
|
|
|
|
| |
| PyAPI_FUNC(void) PyThreadState_EnterTracing(PyThreadState *tstate); |
|
|
| |
| |
| PyAPI_FUNC(void) PyThreadState_LeaveTracing(PyThreadState *tstate); |
|
|
| |
|
|
| |
| |
| |
| |
| PyAPI_FUNC(int) PyGILState_Check(void); |
|
|
| |
| |
| |
| PyAPI_FUNC(PyObject*) _PyThread_CurrentFrames(void); |
|
|
| |
| |
| PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void); |
| PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); |
| PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); |
| PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); |
| PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); |
| PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); |
|
|
| |
|
|
| typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int); |
|
|
| PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc( |
| PyInterpreterState *interp); |
| PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc( |
| PyInterpreterState *interp, |
| _PyFrameEvalFunction eval_frame); |
|
|