Skip to content

Commit c094349

Browse files
committed
HEAD_LOCK() the thread state list.
1 parent 939308e commit c094349

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Python/ceval.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ Py_SetRecursionLimit(int new_limit)
266266
{
267267
PyInterpreterState *interp = _PyInterpreterState_GET();
268268
_PyEval_StopTheWorld(interp);
269+
HEAD_LOCK(interp->runtime);
269270
interp->ceval.recursion_limit = new_limit;
270271
for (PyThreadState *p = interp->threads.head; p != NULL; p = p->next) {
271272
int depth = p->py_recursion_limit - p->py_recursion_remaining;
272273
p->py_recursion_limit = new_limit;
273274
p->py_recursion_remaining = new_limit - depth;
274275
}
276+
HEAD_UNLOCK(interp->runtime);
275277
_PyEval_StartTheWorld(interp);
276278
}
277279

0 commit comments

Comments
 (0)