Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
HEAD_LOCK() the thread state list.
  • Loading branch information
ZeroIntensity committed Jan 13, 2025
commit c094349a30668daf473fecd1e2d16b5942a75986
2 changes: 2 additions & 0 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ Py_SetRecursionLimit(int new_limit)
{
PyInterpreterState *interp = _PyInterpreterState_GET();
_PyEval_StopTheWorld(interp);
HEAD_LOCK(interp->runtime);
interp->ceval.recursion_limit = new_limit;
for (PyThreadState *p = interp->threads.head; p != NULL; p = p->next) {
Comment thread
kumaraditya303 marked this conversation as resolved.
int depth = p->py_recursion_limit - p->py_recursion_remaining;
p->py_recursion_limit = new_limit;
p->py_recursion_remaining = new_limit - depth;
}
HEAD_UNLOCK(interp->runtime);
_PyEval_StartTheWorld(interp);
}

Expand Down