mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-128717: Stop-the-world when setting the recursion limit (#128741)
This commit is contained in:
parent
ff39e3ff7b
commit
f6c61bf2d7
3 changed files with 19 additions and 0 deletions
|
@ -294,6 +294,7 @@ void
|
|||
Py_SetRecursionLimit(int new_limit)
|
||||
{
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
_PyEval_StopTheWorld(interp);
|
||||
interp->ceval.recursion_limit = new_limit;
|
||||
_Py_FOR_EACH_TSTATE_BEGIN(interp, p) {
|
||||
int depth = p->py_recursion_limit - p->py_recursion_remaining;
|
||||
|
@ -301,6 +302,7 @@ Py_SetRecursionLimit(int new_limit)
|
|||
p->py_recursion_remaining = new_limit - depth;
|
||||
}
|
||||
_Py_FOR_EACH_TSTATE_END(interp);
|
||||
_PyEval_StartTheWorld(interp);
|
||||
}
|
||||
|
||||
/* The function _Py_EnterRecursiveCallTstate() only calls _Py_CheckRecursiveCall()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue