[3.13] gh-132744: Check recursion limit in _PY_FRAME_GENERAL (GH-132746) (GH-138032)

This commit is contained in:
Kliment Lamonov 2025-08-22 15:25:24 +03:00 committed by GitHub
parent 8f2280272d
commit ebccd1de88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 164 additions and 122 deletions

View file

@ -961,6 +961,9 @@
PyFunctionObject *func = (PyFunctionObject *)callable;
PyCodeObject *code = (PyCodeObject *)func->func_code;
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), CALL);
}
// _CHECK_RECURSION_REMAINING
{
DEOPT_IF(tstate->py_recursion_remaining <= 1, CALL);
}
// _INIT_CALL_PY_EXACT_ARGS
@ -1044,6 +1047,10 @@
Py_INCREF(method);
Py_DECREF(callable);
}
// _CHECK_RECURSION_REMAINING
{
DEOPT_IF(tstate->py_recursion_remaining <= 1, CALL);
}
// _PY_FRAME_GENERAL
args = &stack_pointer[-oparg];
self_or_null = self;
@ -1890,6 +1897,9 @@
PyFunctionObject *func = (PyFunctionObject *)callable;
PyCodeObject *code = (PyCodeObject *)func->func_code;
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), CALL);
}
// _CHECK_RECURSION_REMAINING
{
DEOPT_IF(tstate->py_recursion_remaining <= 1, CALL);
}
// _INIT_CALL_PY_EXACT_ARGS
@ -1955,6 +1965,10 @@
PyFunctionObject *func = (PyFunctionObject *)callable;
DEOPT_IF(func->func_version != func_version, CALL);
}
// _CHECK_RECURSION_REMAINING
{
DEOPT_IF(tstate->py_recursion_remaining <= 1, CALL);
}
// _PY_FRAME_GENERAL
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];