summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2025-01-12 13:04:30 (GMT)
committerGitHub <noreply@github.com>2025-01-12 13:04:30 (GMT)
commitf6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0 (patch)
tree52d9c1e862ff3ba77df14cadcdc74f7a9de6f699 /Python
parentff39e3ff7bebc9d700d89c5cd22145db2c879cf2 (diff)
downloadcpython-f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0.zip
cpython-f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0.tar.gz
cpython-f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0.tar.bz2
gh-128717: Stop-the-world when setting the recursion limit (#128741)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index e92a11b..e0362c3 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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()