Skip to content

Commit a79e36b

Browse files
committed
Attempt to streamline eval-breaker checks a bit.
1 parent 243e441 commit a79e36b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Python/ceval.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,9 +1345,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
13451345

13461346
#define CHECK_EVAL_BREAKER() \
13471347
if (_Py_atomic_load_relaxed(eval_breaker)) { \
1348-
if (eval_frame_handle_pending(tstate) != 0) { \
1349-
goto error; \
1350-
} \
1348+
goto check_eval_breaker; \
13511349
}
13521350

13531351

@@ -1758,6 +1756,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
17581756

17591757
DISPATCH();
17601758

1759+
check_eval_breaker:
1760+
if (eval_frame_handle_pending(tstate) != 0) {
1761+
goto error;
1762+
}
1763+
DISPATCH();
1764+
17611765
{
17621766
/* Start instructions */
17631767
#if USE_COMPUTED_GOTOS
@@ -1790,8 +1794,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
17901794
next_instr = first_instr + nexti;
17911795
}
17921796
frame->f_state = FRAME_EXECUTING;
1793-
if (oparg < 2) {
1794-
CHECK_EVAL_BREAKER();
1797+
if (_Py_atomic_load_relaxed(eval_breaker) && oparg < 2) {
1798+
goto check_eval_breaker;
17951799
}
17961800
DISPATCH();
17971801
}

0 commit comments

Comments
 (0)