Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../usr/include/python2....
File: pystate.h
[0] Fix | Delete
/* Thread and interpreter state structures and their interfaces */
[1] Fix | Delete
[2] Fix | Delete
[3] Fix | Delete
#ifndef Py_PYSTATE_H
[4] Fix | Delete
#define Py_PYSTATE_H
[5] Fix | Delete
#ifdef __cplusplus
[6] Fix | Delete
extern "C" {
[7] Fix | Delete
#endif
[8] Fix | Delete
[9] Fix | Delete
/* State shared between threads */
[10] Fix | Delete
[11] Fix | Delete
struct _ts; /* Forward */
[12] Fix | Delete
struct _is; /* Forward */
[13] Fix | Delete
[14] Fix | Delete
typedef struct _is {
[15] Fix | Delete
[16] Fix | Delete
struct _is *next;
[17] Fix | Delete
struct _ts *tstate_head;
[18] Fix | Delete
[19] Fix | Delete
PyObject *modules;
[20] Fix | Delete
PyObject *sysdict;
[21] Fix | Delete
PyObject *builtins;
[22] Fix | Delete
PyObject *modules_reloading;
[23] Fix | Delete
[24] Fix | Delete
PyObject *codec_search_path;
[25] Fix | Delete
PyObject *codec_search_cache;
[26] Fix | Delete
PyObject *codec_error_registry;
[27] Fix | Delete
[28] Fix | Delete
#ifdef HAVE_DLOPEN
[29] Fix | Delete
int dlopenflags;
[30] Fix | Delete
#endif
[31] Fix | Delete
#ifdef WITH_TSC
[32] Fix | Delete
int tscdump;
[33] Fix | Delete
#endif
[34] Fix | Delete
[35] Fix | Delete
} PyInterpreterState;
[36] Fix | Delete
[37] Fix | Delete
[38] Fix | Delete
/* State unique per thread */
[39] Fix | Delete
[40] Fix | Delete
struct _frame; /* Avoid including frameobject.h */
[41] Fix | Delete
[42] Fix | Delete
/* Py_tracefunc return -1 when raising an exception, or 0 for success. */
[43] Fix | Delete
typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
[44] Fix | Delete
[45] Fix | Delete
/* The following values are used for 'what' for tracefunc functions: */
[46] Fix | Delete
#define PyTrace_CALL 0
[47] Fix | Delete
#define PyTrace_EXCEPTION 1
[48] Fix | Delete
#define PyTrace_LINE 2
[49] Fix | Delete
#define PyTrace_RETURN 3
[50] Fix | Delete
#define PyTrace_C_CALL 4
[51] Fix | Delete
#define PyTrace_C_EXCEPTION 5
[52] Fix | Delete
#define PyTrace_C_RETURN 6
[53] Fix | Delete
[54] Fix | Delete
typedef struct _ts {
[55] Fix | Delete
/* See Python/ceval.c for comments explaining most fields */
[56] Fix | Delete
[57] Fix | Delete
struct _ts *next;
[58] Fix | Delete
PyInterpreterState *interp;
[59] Fix | Delete
[60] Fix | Delete
struct _frame *frame;
[61] Fix | Delete
int recursion_depth;
[62] Fix | Delete
/* 'tracing' keeps track of the execution depth when tracing/profiling.
[63] Fix | Delete
This is to prevent the actual trace/profile code from being recorded in
[64] Fix | Delete
the trace/profile. */
[65] Fix | Delete
int tracing;
[66] Fix | Delete
int use_tracing;
[67] Fix | Delete
[68] Fix | Delete
Py_tracefunc c_profilefunc;
[69] Fix | Delete
Py_tracefunc c_tracefunc;
[70] Fix | Delete
PyObject *c_profileobj;
[71] Fix | Delete
PyObject *c_traceobj;
[72] Fix | Delete
[73] Fix | Delete
PyObject *curexc_type;
[74] Fix | Delete
PyObject *curexc_value;
[75] Fix | Delete
PyObject *curexc_traceback;
[76] Fix | Delete
[77] Fix | Delete
PyObject *exc_type;
[78] Fix | Delete
PyObject *exc_value;
[79] Fix | Delete
PyObject *exc_traceback;
[80] Fix | Delete
[81] Fix | Delete
PyObject *dict; /* Stores per-thread state */
[82] Fix | Delete
[83] Fix | Delete
/* tick_counter is incremented whenever the check_interval ticker
[84] Fix | Delete
* reaches zero. The purpose is to give a useful measure of the number
[85] Fix | Delete
* of interpreted bytecode instructions in a given thread. This
[86] Fix | Delete
* extremely lightweight statistic collector may be of interest to
[87] Fix | Delete
* profilers (like psyco.jit()), although nothing in the core uses it.
[88] Fix | Delete
*/
[89] Fix | Delete
int tick_counter;
[90] Fix | Delete
[91] Fix | Delete
int gilstate_counter;
[92] Fix | Delete
[93] Fix | Delete
PyObject *async_exc; /* Asynchronous exception to raise */
[94] Fix | Delete
long thread_id; /* Thread id where this tstate was created */
[95] Fix | Delete
[96] Fix | Delete
int trash_delete_nesting;
[97] Fix | Delete
PyObject *trash_delete_later;
[98] Fix | Delete
[99] Fix | Delete
/* XXX signal handlers should also be here */
[100] Fix | Delete
[101] Fix | Delete
} PyThreadState;
[102] Fix | Delete
[103] Fix | Delete
[104] Fix | Delete
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
[105] Fix | Delete
PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
[106] Fix | Delete
PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
[107] Fix | Delete
[108] Fix | Delete
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
[109] Fix | Delete
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);
[110] Fix | Delete
PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *);
[111] Fix | Delete
PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
[112] Fix | Delete
PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
[113] Fix | Delete
#ifdef WITH_THREAD
[114] Fix | Delete
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
[115] Fix | Delete
#endif
[116] Fix | Delete
[117] Fix | Delete
PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
[118] Fix | Delete
PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
[119] Fix | Delete
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
[120] Fix | Delete
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *);
[121] Fix | Delete
[122] Fix | Delete
[123] Fix | Delete
/* Variable and macro for in-line access to current thread state */
[124] Fix | Delete
[125] Fix | Delete
PyAPI_DATA(PyThreadState *) _PyThreadState_Current;
[126] Fix | Delete
[127] Fix | Delete
#ifdef Py_DEBUG
[128] Fix | Delete
#define PyThreadState_GET() PyThreadState_Get()
[129] Fix | Delete
#else
[130] Fix | Delete
#define PyThreadState_GET() (_PyThreadState_Current)
[131] Fix | Delete
#endif
[132] Fix | Delete
[133] Fix | Delete
typedef
[134] Fix | Delete
enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
[135] Fix | Delete
PyGILState_STATE;
[136] Fix | Delete
[137] Fix | Delete
/* Ensure that the current thread is ready to call the Python
[138] Fix | Delete
C API, regardless of the current state of Python, or of its
[139] Fix | Delete
thread lock. This may be called as many times as desired
[140] Fix | Delete
by a thread so long as each call is matched with a call to
[141] Fix | Delete
PyGILState_Release(). In general, other thread-state APIs may
[142] Fix | Delete
be used between _Ensure() and _Release() calls, so long as the
[143] Fix | Delete
thread-state is restored to its previous state before the Release().
[144] Fix | Delete
For example, normal use of the Py_BEGIN_ALLOW_THREADS/
[145] Fix | Delete
Py_END_ALLOW_THREADS macros are acceptable.
[146] Fix | Delete
[147] Fix | Delete
The return value is an opaque "handle" to the thread state when
[148] Fix | Delete
PyGILState_Ensure() was called, and must be passed to
[149] Fix | Delete
PyGILState_Release() to ensure Python is left in the same state. Even
[150] Fix | Delete
though recursive calls are allowed, these handles can *not* be shared -
[151] Fix | Delete
each unique call to PyGILState_Ensure must save the handle for its
[152] Fix | Delete
call to PyGILState_Release.
[153] Fix | Delete
[154] Fix | Delete
When the function returns, the current thread will hold the GIL.
[155] Fix | Delete
[156] Fix | Delete
Failure is a fatal error.
[157] Fix | Delete
*/
[158] Fix | Delete
PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
[159] Fix | Delete
[160] Fix | Delete
/* Release any resources previously acquired. After this call, Python's
[161] Fix | Delete
state will be the same as it was prior to the corresponding
[162] Fix | Delete
PyGILState_Ensure() call (but generally this state will be unknown to
[163] Fix | Delete
the caller, hence the use of the GILState API.)
[164] Fix | Delete
[165] Fix | Delete
Every call to PyGILState_Ensure must be matched by a call to
[166] Fix | Delete
PyGILState_Release on the same thread.
[167] Fix | Delete
*/
[168] Fix | Delete
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
[169] Fix | Delete
[170] Fix | Delete
/* Helper/diagnostic function - get the current thread state for
[171] Fix | Delete
this thread. May return NULL if no GILState API has been used
[172] Fix | Delete
on the current thread. Note that the main thread always has such a
[173] Fix | Delete
thread-state, even if no auto-thread-state call has been made
[174] Fix | Delete
on the main thread.
[175] Fix | Delete
*/
[176] Fix | Delete
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
[177] Fix | Delete
[178] Fix | Delete
/* The implementation of sys._current_frames() Returns a dict mapping
[179] Fix | Delete
thread id to that thread's current frame.
[180] Fix | Delete
*/
[181] Fix | Delete
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
[182] Fix | Delete
[183] Fix | Delete
/* Routines for advanced debuggers, requested by David Beazley.
[184] Fix | Delete
Don't use unless you know what you are doing! */
[185] Fix | Delete
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
[186] Fix | Delete
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
[187] Fix | Delete
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
[188] Fix | Delete
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
[189] Fix | Delete
[190] Fix | Delete
typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
[191] Fix | Delete
[192] Fix | Delete
/* hook for PyEval_GetFrame(), requested for Psyco */
[193] Fix | Delete
PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame;
[194] Fix | Delete
[195] Fix | Delete
#ifdef __cplusplus
[196] Fix | Delete
}
[197] Fix | Delete
#endif
[198] Fix | Delete
#endif /* !Py_PYSTATE_H */
[199] Fix | Delete
[200] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function