Skip to content

Commit 7bda9de

Browse files
Simplify DISPATCH by hoisting eval_breaker ahead of time. (gh-12243)
1 parent d5a70c6 commit 7bda9de

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Python/ceval.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
602602
PyObject **fastlocals, **freevars;
603603
PyObject *retval = NULL; /* Return value */
604604
PyThreadState *tstate = _PyThreadState_GET();
605+
_Py_atomic_int *eval_breaker = &_PyRuntime.ceval.eval_breaker;
605606
PyCodeObject *co;
606607

607608
/* when tracing we set things up so that
@@ -687,7 +688,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
687688

688689
#define DISPATCH() \
689690
{ \
690-
if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \
691+
if (!_Py_atomic_load_relaxed(eval_breaker)) { \
691692
FAST_DISPATCH(); \
692693
} \
693694
continue; \
@@ -989,7 +990,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
989990
async I/O handler); see Py_AddPendingCall() and
990991
Py_MakePendingCalls() above. */
991992

992-
if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) {
993+
if (_Py_atomic_load_relaxed(eval_breaker)) {
993994
opcode = _Py_OPCODE(*next_instr);
994995
if (opcode == SETUP_FINALLY ||
995996
opcode == SETUP_WITH ||

0 commit comments

Comments
 (0)