| 
									
										
										
										
											2017-09-07 23:51:28 -06:00
										 |  |  | #ifndef Py_INTERNAL_CEVAL_H
 | 
					
						
							|  |  |  | #define Py_INTERNAL_CEVAL_H
 | 
					
						
							|  |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 23:02:26 +02:00
										 |  |  | #ifndef Py_BUILD_CORE
 | 
					
						
							|  |  |  | #  error "this header requires Py_BUILD_CORE define"
 | 
					
						
							| 
									
										
										
										
											2018-11-09 13:03:37 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-18 00:33:50 +09:00
										 |  |  | #include "dynamic_annotations.h" // _Py_ANNOTATE_RWLOCK_CREATE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:05:59 +02:00
										 |  |  | #include "pycore_interp.h"        // PyInterpreterState.eval_frame
 | 
					
						
							|  |  |  | #include "pycore_pystate.h"       // _PyThreadState_GET()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 23:51:20 +02:00
										 |  |  | /* Forward declarations */ | 
					
						
							| 
									
										
										
										
											2019-10-04 02:21:05 +02:00
										 |  |  | struct pyruntimestate; | 
					
						
							| 
									
										
										
										
											2019-10-02 23:51:20 +02:00
										 |  |  | struct _ceval_runtime_state; | 
					
						
							| 
									
										
										
										
											2019-11-14 12:20:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 20:25:22 +02:00
										 |  |  | // Export for '_lsprof' shared extension
 | 
					
						
							|  |  |  | PyAPI_FUNC(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-03 09:39:50 -07:00
										 |  |  | extern int _PyEval_SetOpcodeTrace(PyFrameObject *f, bool enable); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 20:25:22 +02:00
										 |  |  | // Helper to look up a builtin object
 | 
					
						
							|  |  |  | // Export for 'array' shared extension
 | 
					
						
							|  |  |  | PyAPI_FUNC(PyObject*) _PyEval_GetBuiltin(PyObject *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern PyObject* _PyEval_GetBuiltinId(_Py_Identifier *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern void _PyEval_SetSwitchInterval(unsigned long microseconds); | 
					
						
							|  |  |  | extern unsigned long _PyEval_GetSwitchInterval(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Export for '_queue' shared extension
 | 
					
						
							|  |  |  | PyAPI_FUNC(int) _PyEval_MakePendingCalls(PyThreadState *); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-13 17:09:24 -07:00
										 |  |  | #ifndef Py_DEFAULT_RECURSION_LIMIT
 | 
					
						
							| 
									
										
										
										
											2022-10-05 01:34:03 +01:00
										 |  |  | #  define Py_DEFAULT_RECURSION_LIMIT 1000
 | 
					
						
							| 
									
										
										
										
											2022-01-13 17:09:24 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-17 18:56:44 +01:00
										 |  |  | extern void _Py_FinishPendingCalls(PyThreadState *tstate); | 
					
						
							| 
									
										
										
										
											2023-05-08 13:15:09 -06:00
										 |  |  | extern void _PyEval_InitState(PyInterpreterState *, PyThread_type_lock); | 
					
						
							| 
									
										
										
										
											2020-04-08 17:54:59 +02:00
										 |  |  | extern void _PyEval_FiniState(struct _ceval_state *ceval); | 
					
						
							| 
									
										
										
										
											2023-07-25 05:16:28 +02:00
										 |  |  | extern void _PyEval_SignalReceived(PyInterpreterState *interp); | 
					
						
							| 
									
										
										
										
											2023-08-24 18:06:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-09 07:39:51 -06:00
										 |  |  | // bitwise flags:
 | 
					
						
							|  |  |  | #define _Py_PENDING_MAINTHREADONLY 1
 | 
					
						
							|  |  |  | #define _Py_PENDING_RAWFREE 2
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-25 05:16:28 +02:00
										 |  |  | // Export for '_testinternalcapi' shared extension
 | 
					
						
							| 
									
										
										
										
											2019-05-10 23:39:09 +02:00
										 |  |  | PyAPI_FUNC(int) _PyEval_AddPendingCall( | 
					
						
							| 
									
										
										
										
											2020-04-08 23:35:05 +02:00
										 |  |  |     PyInterpreterState *interp, | 
					
						
							| 
									
										
										
										
											2023-09-19 15:01:34 -06:00
										 |  |  |     _Py_pending_call_func func, | 
					
						
							| 
									
										
										
										
											2023-06-13 15:02:19 -06:00
										 |  |  |     void *arg, | 
					
						
							| 
									
										
										
										
											2023-10-09 07:39:51 -06:00
										 |  |  |     int flags); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-25 05:16:28 +02:00
										 |  |  | extern void _PyEval_SignalAsyncExc(PyInterpreterState *interp); | 
					
						
							| 
									
										
										
										
											2020-04-15 01:16:24 +09:00
										 |  |  | #ifdef HAVE_FORK
 | 
					
						
							| 
									
										
										
										
											2020-06-02 18:44:54 +02:00
										 |  |  | extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate); | 
					
						
							| 
									
										
										
										
											2020-04-15 01:16:24 +09:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-09-07 23:51:28 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 03:03:22 +01:00
										 |  |  | // Used by sys.call_tracing()
 | 
					
						
							|  |  |  | extern PyObject* _PyEval_CallTracing(PyObject *func, PyObject *args); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 01:15:32 +01:00
										 |  |  | // Used by sys.get_asyncgen_hooks()
 | 
					
						
							|  |  |  | extern PyObject* _PyEval_GetAsyncGenFirstiter(void); | 
					
						
							|  |  |  | extern PyObject* _PyEval_GetAsyncGenFinalizer(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Used by sys.set_asyncgen_hooks()
 | 
					
						
							|  |  |  | extern int _PyEval_SetAsyncGenFirstiter(PyObject *); | 
					
						
							|  |  |  | extern int _PyEval_SetAsyncGenFinalizer(PyObject *); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 02:24:00 +01:00
										 |  |  | // Used by sys.get_coroutine_origin_tracking_depth()
 | 
					
						
							|  |  |  | // and sys.set_coroutine_origin_tracking_depth()
 | 
					
						
							|  |  |  | extern int _PyEval_GetCoroutineOriginTrackingDepth(void); | 
					
						
							|  |  |  | extern int _PyEval_SetCoroutineOriginTrackingDepth(int depth); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern void _PyEval_Fini(void); | 
					
						
							| 
									
										
										
										
											2019-06-03 21:30:58 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-18 19:20:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-20 15:17:18 +01:00
										 |  |  | extern PyObject* _PyEval_GetBuiltins(PyThreadState *tstate); | 
					
						
							| 
									
										
										
										
											2022-03-21 02:24:00 +01:00
										 |  |  | extern PyObject* _PyEval_BuiltinsFromGlobals( | 
					
						
							| 
									
										
										
										
											2021-02-20 15:17:18 +01:00
										 |  |  |     PyThreadState *tstate, | 
					
						
							|  |  |  |     PyObject *globals); | 
					
						
							| 
									
										
										
										
											2021-02-18 19:20:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-30 18:11:18 +01:00
										 |  |  | // Trampoline API
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     // Callback to initialize the trampoline state
 | 
					
						
							|  |  |  |     void* (*init_state)(void); | 
					
						
							|  |  |  |     // Callback to register every trampoline being created
 | 
					
						
							|  |  |  |     void (*write_state)(void* state, const void *code_addr, | 
					
						
							|  |  |  |                         unsigned int code_size, PyCodeObject* code); | 
					
						
							|  |  |  |     // Callback to free the trampoline state
 | 
					
						
							|  |  |  |     int (*free_state)(void* state); | 
					
						
							|  |  |  | } _PyPerf_Callbacks; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int _PyPerfTrampoline_SetCallbacks(_PyPerf_Callbacks *); | 
					
						
							|  |  |  | extern void _PyPerfTrampoline_GetCallbacks(_PyPerf_Callbacks *); | 
					
						
							|  |  |  | extern int _PyPerfTrampoline_Init(int activate); | 
					
						
							|  |  |  | extern int _PyPerfTrampoline_Fini(void); | 
					
						
							|  |  |  | extern int _PyIsPerfTrampolineActive(void); | 
					
						
							|  |  |  | extern PyStatus _PyPerfTrampoline_AfterFork_Child(void); | 
					
						
							|  |  |  | #ifdef PY_HAVE_PERF_TRAMPOLINE
 | 
					
						
							|  |  |  | extern _PyPerf_Callbacks _Py_perfmap_callbacks; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2021-02-18 19:20:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-14 12:20:46 +01:00
										 |  |  | static inline PyObject* | 
					
						
							| 
									
										
										
										
											2022-02-25 16:22:00 +01:00
										 |  |  | _PyEval_EvalFrame(PyThreadState *tstate, struct _PyInterpreterFrame *frame, int throwflag) | 
					
						
							| 
									
										
										
										
											2019-11-14 12:20:46 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-05-27 16:31:41 +01:00
										 |  |  |     EVAL_CALL_STAT_INC(EVAL_CALL_TOTAL); | 
					
						
							| 
									
										
										
										
											2021-10-11 11:34:02 +01:00
										 |  |  |     if (tstate->interp->eval_frame == NULL) { | 
					
						
							|  |  |  |         return _PyEval_EvalFrameDefault(tstate, frame, throwflag); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-07-26 11:22:16 +01:00
										 |  |  |     return tstate->interp->eval_frame(tstate, frame, throwflag); | 
					
						
							| 
									
										
										
										
											2019-11-14 12:20:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 02:24:00 +01:00
										 |  |  | extern PyObject* | 
					
						
							| 
									
										
										
										
											2021-02-01 10:42:03 +00:00
										 |  |  | _PyEval_Vector(PyThreadState *tstate, | 
					
						
							| 
									
										
										
										
											2021-11-23 09:53:24 +00:00
										 |  |  |             PyFunctionObject *func, PyObject *locals, | 
					
						
							| 
									
										
										
										
											2021-02-01 10:42:03 +00:00
										 |  |  |             PyObject* const* args, size_t argcount, | 
					
						
							|  |  |  |             PyObject *kwnames); | 
					
						
							| 
									
										
										
										
											2019-11-16 01:03:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-05 13:23:00 -06:00
										 |  |  | extern int _PyEval_ThreadsInitialized(void); | 
					
						
							| 
									
										
										
										
											2023-05-05 15:59:20 -06:00
										 |  |  | extern PyStatus _PyEval_InitGIL(PyThreadState *tstate, int own_gil); | 
					
						
							| 
									
										
										
										
											2021-02-19 15:10:45 +01:00
										 |  |  | extern void _PyEval_FiniGIL(PyInterpreterState *interp); | 
					
						
							| 
									
										
										
										
											2020-03-09 21:24:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-06 15:59:30 -06:00
										 |  |  | extern void _PyEval_AcquireLock(PyThreadState *tstate); | 
					
						
							| 
									
										
										
										
											2023-06-01 16:24:10 -06:00
										 |  |  | extern void _PyEval_ReleaseLock(PyInterpreterState *, PyThreadState *); | 
					
						
							| 
									
										
										
										
											2020-03-18 02:26:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-08 22:56:37 +01:00
										 |  |  | extern void _PyEval_DeactivateOpCache(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* --- _Py_EnterRecursiveCall() ----------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef USE_STACKCHECK
 | 
					
						
							|  |  |  | /* With USE_STACKCHECK macro defined, trigger stack checks in
 | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  |    _Py_CheckRecursiveCall() on every 64th call to _Py_EnterRecursiveCall. */ | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | static inline int _Py_MakeRecCheck(PyThreadState *tstate)  { | 
					
						
							| 
									
										
										
										
											2022-10-05 01:34:03 +01:00
										 |  |  |     return (tstate->c_recursion_remaining-- <= 0 | 
					
						
							|  |  |  |             || (tstate->c_recursion_remaining & 63) == 0); | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline int _Py_MakeRecCheck(PyThreadState *tstate) { | 
					
						
							| 
									
										
										
										
											2022-10-05 01:34:03 +01:00
										 |  |  |     return tstate->c_recursion_remaining-- <= 0; | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 18:06:53 +02:00
										 |  |  | // Export for '_json' shared extension, used via _Py_EnterRecursiveCall()
 | 
					
						
							|  |  |  | // static inline function.
 | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | PyAPI_FUNC(int) _Py_CheckRecursiveCall( | 
					
						
							|  |  |  |     PyThreadState *tstate, | 
					
						
							|  |  |  |     const char *where); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-05 01:34:03 +01:00
										 |  |  | int _Py_CheckRecursiveCallPy( | 
					
						
							|  |  |  |     PyThreadState *tstate); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  | static inline int _Py_EnterRecursiveCallTstate(PyThreadState *tstate, | 
					
						
							|  |  |  |                                                const char *where) { | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  |     return (_Py_MakeRecCheck(tstate) && _Py_CheckRecursiveCall(tstate, where)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  | static inline int _Py_EnterRecursiveCall(const char *where) { | 
					
						
							| 
									
										
										
										
											2021-10-13 14:09:13 +02:00
										 |  |  |     PyThreadState *tstate = _PyThreadState_GET(); | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  |     return _Py_EnterRecursiveCallTstate(tstate, where); | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  | static inline void _Py_LeaveRecursiveCallTstate(PyThreadState *tstate)  { | 
					
						
							| 
									
										
										
										
											2022-10-05 01:34:03 +01:00
										 |  |  |     tstate->c_recursion_remaining++; | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  | static inline void _Py_LeaveRecursiveCall(void)  { | 
					
						
							| 
									
										
										
										
											2021-10-13 14:09:13 +02:00
										 |  |  |     PyThreadState *tstate = _PyThreadState_GET(); | 
					
						
							| 
									
										
										
										
											2022-05-04 13:30:23 +02:00
										 |  |  |     _Py_LeaveRecursiveCallTstate(tstate); | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 02:24:00 +01:00
										 |  |  | extern struct _PyInterpreterFrame* _PyEval_GetFrame(void); | 
					
						
							| 
									
										
										
										
											2021-07-26 11:22:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 02:24:00 +01:00
										 |  |  | extern PyObject* _Py_MakeCoro(PyFunctionObject *func); | 
					
						
							| 
									
										
										
										
											2020-03-13 10:19:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:28:27 +01:00
										 |  |  | /* Handle signals, pending calls, GIL drop request
 | 
					
						
							|  |  |  |    and asynchronous exception */ | 
					
						
							| 
									
										
										
										
											2022-08-24 14:21:01 +01:00
										 |  |  | extern int _Py_HandlePending(PyThreadState *tstate); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-05 17:05:02 -06:00
										 |  |  | extern PyObject * _PyEval_GetFrameLocals(void); | 
					
						
							| 
									
										
										
										
											2022-08-24 14:21:01 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 13:37:19 -07:00
										 |  |  | extern const binaryfunc _PyEval_BinaryOps[]; | 
					
						
							|  |  |  | int _PyEval_CheckExceptStarTypeValid(PyThreadState *tstate, PyObject* right); | 
					
						
							|  |  |  | int _PyEval_CheckExceptTypeValid(PyThreadState *tstate, PyObject* right); | 
					
						
							|  |  |  | int _PyEval_ExceptionGroupMatch(PyObject* exc_value, PyObject *match_type, PyObject **match, PyObject **rest); | 
					
						
							|  |  |  | void _PyEval_FormatAwaitableError(PyThreadState *tstate, PyTypeObject *type, int oparg); | 
					
						
							|  |  |  | void _PyEval_FormatExcCheckArg(PyThreadState *tstate, PyObject *exc, const char *format_str, PyObject *obj); | 
					
						
							|  |  |  | void _PyEval_FormatExcUnbound(PyThreadState *tstate, PyCodeObject *co, int oparg); | 
					
						
							|  |  |  | void _PyEval_FormatKwargsError(PyThreadState *tstate, PyObject *func, PyObject *kwargs); | 
					
						
							|  |  |  | PyObject *_PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t nargs, PyObject *kwargs); | 
					
						
							|  |  |  | PyObject *_PyEval_MatchKeys(PyThreadState *tstate, PyObject *map, PyObject *keys); | 
					
						
							|  |  |  | int _PyEval_UnpackIterable(PyThreadState *tstate, PyObject *v, int argcnt, int argcntafter, PyObject **sp); | 
					
						
							| 
									
										
										
										
											2023-08-17 11:29:58 -07:00
										 |  |  | void _PyEval_FrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame); | 
					
						
							| 
									
										
										
										
											2023-07-20 13:37:19 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-05 01:34:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-04 16:09:48 +01:00
										 |  |  | #define _PY_GIL_DROP_REQUEST_BIT 0
 | 
					
						
							|  |  |  | #define _PY_SIGNALS_PENDING_BIT 1
 | 
					
						
							|  |  |  | #define _PY_CALLS_TO_DO_BIT 2
 | 
					
						
							|  |  |  | #define _PY_ASYNC_EXCEPTION_BIT 3
 | 
					
						
							|  |  |  | #define _PY_GC_SCHEDULED_BIT 4
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Reserve a few bits for future use */ | 
					
						
							|  |  |  | #define _PY_EVAL_EVENTS_BITS 8
 | 
					
						
							|  |  |  | #define _PY_EVAL_EVENTS_MASK ((1 << _PY_EVAL_EVENTS_BITS)-1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void | 
					
						
							|  |  |  | _Py_set_eval_breaker_bit(PyInterpreterState *interp, uint32_t bit, uint32_t set) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     assert(set == 0 || set == 1); | 
					
						
							|  |  |  |     uintptr_t to_set = set << bit; | 
					
						
							|  |  |  |     uintptr_t mask = ((uintptr_t)1) << bit; | 
					
						
							|  |  |  |     uintptr_t old = _Py_atomic_load_uintptr(&interp->ceval.eval_breaker); | 
					
						
							|  |  |  |     if ((old & mask) == to_set) { | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     uintptr_t new; | 
					
						
							|  |  |  |     do { | 
					
						
							|  |  |  |         new = (old & ~mask) | to_set; | 
					
						
							|  |  |  |     } while (!_Py_atomic_compare_exchange_uintptr(&interp->ceval.eval_breaker, &old, new)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline bool | 
					
						
							|  |  |  | _Py_eval_breaker_bit_is_set(PyInterpreterState *interp, int32_t bit) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return _Py_atomic_load_uintptr_relaxed(&interp->ceval.eval_breaker) & (((uintptr_t)1) << bit); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-07 23:51:28 -06:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #endif /* !Py_INTERNAL_CEVAL_H */
 |