Skip to content

Commit 3edc57c

Browse files
committed
Revert "pythonGH-128563: Simplify recursion check in _PyEval_EvalFrameDefault (pythonGH-129481)"
This reverts commit c3ae5c9.
1 parent cf4c4ec commit 3edc57c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Python/ceval.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
786786

787787
_PyInterpreterFrame entry_frame;
788788

789-
if (_Py_EnterRecursiveCallTstate(tstate, "")) {
790-
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
791-
_PyEval_FrameClearAndPop(tstate, frame);
792-
return NULL;
793-
}
789+
794790

795791
/* Local "register" variables.
796792
* These are cached values from the frame and code object. */
@@ -820,6 +816,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
820816
tstate->current_frame = frame;
821817

822818
tstate->c_recursion_remaining -= (PY_EVAL_C_STACK_UNITS - 1);
819+
if (_Py_EnterRecursiveCallTstate(tstate, "")) {
820+
tstate->c_recursion_remaining--;
821+
tstate->py_recursion_remaining--;
822+
goto exit_unwind;
823+
}
823824

824825
/* support for generator.throw() */
825826
if (throwflag) {

0 commit comments

Comments
 (0)