GH-106057: Handle recursion errors in inline class calls properly. (GH-106108)

This commit is contained in:
Mark Shannon 2023-07-07 11:09:26 +01:00 committed by GitHub
parent e1d45b8ed4
commit 24fb627ea7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 91 deletions

View file

@ -2985,9 +2985,6 @@ dummy_func(
goto error;
}
Py_DECREF(tp);
if (_Py_EnterRecursivePy(tstate)) {
goto exit_unwind;
}
_PyInterpreterFrame *shim = _PyFrame_PushTrampolineUnchecked(
tstate, (PyCodeObject *)&_Py_InitCleanup, 1, 0);
assert(_PyCode_CODE((PyCodeObject *)shim->f_executable)[1].op.code == EXIT_INIT_CHECK);
@ -3011,6 +3008,10 @@ dummy_func(
shim->previous = frame;
frame = cframe.current_frame = init_frame;
CALL_STAT_INC(inlined_py_calls);
/* Account for pushing the extra frame.
* We don't check recursion depth here,
* as it will be checked after start_frame */
tstate->py_recursion_remaining--;
goto start_frame;
}