Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/python3.12/internal/pycore_ceval.h
$ cat -n /usr/include/python3.12/internal/pycore_ceval.h 1 #ifndef Py_INTERNAL_CEVAL_H 2 #define Py_INTERNAL_CEVAL_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #ifndef Py_BUILD_CORE 8 # error "this header requires Py_BUILD_CORE define" 9 #endif 10 11 /* Forward declarations */ 12 struct pyruntimestate; 13 struct _ceval_runtime_state; 14 15 #ifndef Py_DEFAULT_RECURSION_LIMIT 16 # define Py_DEFAULT_RECURSION_LIMIT 1000 17 #endif 18 19 #include "pycore_interp.h" // PyInterpreterState.eval_frame 20 #include "pycore_pystate.h" // _PyThreadState_GET() 21 22 23 extern void _Py_FinishPendingCalls(PyThreadState *tstate); 24 extern void _PyEval_InitState(PyInterpreterState *, PyThread_type_lock); 25 extern void _PyEval_FiniState(struct _ceval_state *ceval); 26 PyAPI_FUNC(void) _PyEval_SignalReceived(PyInterpreterState *interp); 27 PyAPI_FUNC(int) _PyEval_AddPendingCall( 28 PyInterpreterState *interp, 29 int (*func)(void *), 30 void *arg, 31 int mainthreadonly); 32 PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyInterpreterState *interp); 33 #ifdef HAVE_FORK 34 extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate); 35 #endif 36 37 // Used by sys.call_tracing() 38 extern PyObject* _PyEval_CallTracing(PyObject *func, PyObject *args); 39 40 // Used by sys.get_asyncgen_hooks() 41 extern PyObject* _PyEval_GetAsyncGenFirstiter(void); 42 extern PyObject* _PyEval_GetAsyncGenFinalizer(void); 43 44 // Used by sys.set_asyncgen_hooks() 45 extern int _PyEval_SetAsyncGenFirstiter(PyObject *); 46 extern int _PyEval_SetAsyncGenFinalizer(PyObject *); 47 48 // Used by sys.get_coroutine_origin_tracking_depth() 49 // and sys.set_coroutine_origin_tracking_depth() 50 extern int _PyEval_GetCoroutineOriginTrackingDepth(void); 51 extern int _PyEval_SetCoroutineOriginTrackingDepth(int depth); 52 53 extern void _PyEval_Fini(void); 54 55 56 extern PyObject* _PyEval_GetBuiltins(PyThreadState *tstate); 57 extern PyObject* _PyEval_BuiltinsFromGlobals( 58 PyThreadState *tstate, 59 PyObject *globals); 60 61 // Trampoline API 62 63 typedef struct { 64 // Callback to initialize the trampoline state 65 void* (*init_state)(void); 66 // Callback to register every trampoline being created 67 void (*write_state)(void* state, const void *code_addr, 68 unsigned int code_size, PyCodeObject* code); 69 // Callback to free the trampoline state 70 int (*free_state)(void* state); 71 } _PyPerf_Callbacks; 72 73 extern int _PyPerfTrampoline_SetCallbacks(_PyPerf_Callbacks *); 74 extern void _PyPerfTrampoline_GetCallbacks(_PyPerf_Callbacks *); 75 extern int _PyPerfTrampoline_Init(int activate); 76 extern int _PyPerfTrampoline_Fini(void); 77 extern void _PyPerfTrampoline_FreeArenas(void); 78 extern int _PyIsPerfTrampolineActive(void); 79 extern PyStatus _PyPerfTrampoline_AfterFork_Child(void); 80 #ifdef PY_HAVE_PERF_TRAMPOLINE 81 extern _PyPerf_Callbacks _Py_perfmap_callbacks; 82 #endif 83 84 static inline PyObject* 85 _PyEval_EvalFrame(PyThreadState *tstate, struct _PyInterpreterFrame *frame, int throwflag) 86 { 87 EVAL_CALL_STAT_INC(EVAL_CALL_TOTAL); 88 if (tstate->interp->eval_frame == NULL) { 89 return _PyEval_EvalFrameDefault(tstate, frame, throwflag); 90 } 91 return tstate->interp->eval_frame(tstate, frame, throwflag); 92 } 93 94 extern PyObject* 95 _PyEval_Vector(PyThreadState *tstate, 96 PyFunctionObject *func, PyObject *locals, 97 PyObject* const* args, size_t argcount, 98 PyObject *kwnames); 99 100 extern int _PyEval_ThreadsInitialized(void); 101 extern PyStatus _PyEval_InitGIL(PyThreadState *tstate, int own_gil); 102 extern void _PyEval_FiniGIL(PyInterpreterState *interp); 103 104 extern void _PyEval_AcquireLock(PyThreadState *tstate); 105 extern void _PyEval_ReleaseLock(PyInterpreterState *, PyThreadState *); 106 extern PyThreadState * _PyThreadState_SwapNoGIL(PyThreadState *); 107 108 extern void _PyEval_DeactivateOpCache(void); 109 110 111 /* --- _Py_EnterRecursiveCall() ----------------------------------------- */ 112 113 #ifdef USE_STACKCHECK 114 /* With USE_STACKCHECK macro defined, trigger stack checks in 115 _Py_CheckRecursiveCall() on every 64th call to _Py_EnterRecursiveCall. */ 116 static inline int _Py_MakeRecCheck(PyThreadState *tstate) { 117 return (tstate->c_recursion_remaining-- <= 0 118 || (tstate->c_recursion_remaining & 63) == 0); 119 } 120 #else 121 static inline int _Py_MakeRecCheck(PyThreadState *tstate) { 122 return tstate->c_recursion_remaining-- <= 0; 123 } 124 #endif 125 126 PyAPI_FUNC(int) _Py_CheckRecursiveCall( 127 PyThreadState *tstate, 128 const char *where); 129 130 int _Py_CheckRecursiveCallPy( 131 PyThreadState *tstate); 132 133 static inline int _Py_EnterRecursiveCallTstate(PyThreadState *tstate, 134 const char *where) { 135 return (_Py_MakeRecCheck(tstate) && _Py_CheckRecursiveCall(tstate, where)); 136 } 137 138 static inline int _Py_EnterRecursiveCall(const char *where) { 139 PyThreadState *tstate = _PyThreadState_GET(); 140 return _Py_EnterRecursiveCallTstate(tstate, where); 141 } 142 143 static inline void _Py_LeaveRecursiveCallTstate(PyThreadState *tstate) { 144 tstate->c_recursion_remaining++; 145 } 146 147 static inline void _Py_LeaveRecursiveCall(void) { 148 PyThreadState *tstate = _PyThreadState_GET(); 149 _Py_LeaveRecursiveCallTstate(tstate); 150 } 151 152 extern struct _PyInterpreterFrame* _PyEval_GetFrame(void); 153 154 extern PyObject* _Py_MakeCoro(PyFunctionObject *func); 155 156 extern int _Py_HandlePending(PyThreadState *tstate); 157 158 extern PyObject * _PyEval_GetFrameLocals(void); 159 160 161 #ifdef __cplusplus 162 } 163 #endif 164 #endif /* !Py_INTERNAL_CEVAL_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™