]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.10/Include/ceval.h
58b2dedf6d6acae42d2c74bc1d63aee0f395d575
8 /* Interface to random parts in ceval.c */
10 PyAPI_FUNC(PyObject
*) PyEval_CallObjectWithKeywords(
11 PyObject
*, PyObject
*, PyObject
*);
14 #define PyEval_CallObject(func,arg) \
15 PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
17 PyAPI_FUNC(PyObject
*) PyEval_CallFunction(PyObject
*obj
,
18 const char *format
, ...);
19 PyAPI_FUNC(PyObject
*) PyEval_CallMethod(PyObject
*obj
,
20 const char *methodname
,
21 const char *format
, ...);
23 PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc
, PyObject
*);
24 PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc
, PyObject
*);
26 struct _frame
; /* Avoid including frameobject.h */
28 PyAPI_FUNC(PyObject
*) PyEval_GetBuiltins(void);
29 PyAPI_FUNC(PyObject
*) PyEval_GetGlobals(void);
30 PyAPI_FUNC(PyObject
*) PyEval_GetLocals(void);
31 PyAPI_FUNC(struct _frame
*) PyEval_GetFrame(void);
32 PyAPI_FUNC(int) PyEval_GetRestricted(void);
34 /* Look at the current frame's (if any) code's co_flags, and turn on
35 the corresponding compiler flags in cf->cf_flags. Return 1 if any
36 flag was set, else return 0. */
37 PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags
*cf
);
39 PyAPI_FUNC(int) Py_FlushLine(void);
41 PyAPI_FUNC(int) Py_AddPendingCall(int (*func
)(void *), void *arg
);
42 PyAPI_FUNC(int) Py_MakePendingCalls(void);
44 /* Protection against deeply nested recursive calls */
45 PyAPI_FUNC(void) Py_SetRecursionLimit(int);
46 PyAPI_FUNC(int) Py_GetRecursionLimit(void);
48 #define Py_EnterRecursiveCall(where) \
49 (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
50 _Py_CheckRecursiveCall(where))
51 #define Py_LeaveRecursiveCall() \
52 (--PyThreadState_GET()->recursion_depth)
53 PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where
);
54 PyAPI_DATA(int) _Py_CheckRecursionLimit
;
56 # define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
58 # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
61 PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject
*);
62 PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject
*);
64 PyAPI_FUNC(PyObject
*) PyEval_GetCallStats(PyObject
*);
65 PyAPI_FUNC(PyObject
*) PyEval_EvalFrame(struct _frame
*);
66 PyAPI_FUNC(PyObject
*) PyEval_EvalFrameEx(struct _frame
*f
, int exc
);
68 /* this used to be handled on a per-thread basis - now just two globals */
69 PyAPI_DATA(volatile int) _Py_Ticker
;
70 PyAPI_DATA(int) _Py_CheckInterval
;
72 /* Interface for threads.
74 A module that plans to do a blocking system call (or something else
75 that lasts a long time and doesn't touch Python data) can allow other
76 threads to run as follows:
78 ...preparations here...
79 Py_BEGIN_ALLOW_THREADS
80 ...blocking system call here...
82 ...interpret result here...
84 The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
86 To leave the block in the middle (e.g., with return), you must insert
87 a line containing Py_BLOCK_THREADS before the return, e.g.
89 if (...premature_exit...) {
91 PyErr_SetFromErrno(PyExc_IOError);
98 if (...premature_exit...) {
99 PyErr_SetFromErrno(PyExc_IOError);
104 For convenience, that the value of 'errno' is restored across
105 Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
107 WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
108 Py_END_ALLOW_THREADS!!!
110 The function PyEval_InitThreads() should be called only from
111 initthread() in "threadmodule.c".
113 Note that not yet all candidates have been converted to use this
117 PyAPI_FUNC(PyThreadState
*) PyEval_SaveThread(void);
118 PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState
*);
122 PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
123 PyAPI_FUNC(void) PyEval_InitThreads(void);
124 PyAPI_FUNC(void) PyEval_AcquireLock(void);
125 PyAPI_FUNC(void) PyEval_ReleaseLock(void);
126 PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState
*tstate
);
127 PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState
*tstate
);
128 PyAPI_FUNC(void) PyEval_ReInitThreads(void);
130 #define Py_BEGIN_ALLOW_THREADS { \
131 PyThreadState *_save; \
132 _save = PyEval_SaveThread();
133 #define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
134 #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
135 #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
138 #else /* !WITH_THREAD */
140 #define Py_BEGIN_ALLOW_THREADS {
141 #define Py_BLOCK_THREADS
142 #define Py_UNBLOCK_THREADS
143 #define Py_END_ALLOW_THREADS }
145 #endif /* !WITH_THREAD */
147 PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject
*, Py_ssize_t
*);
153 #endif /* !Py_CEVAL_H */