Skip to content

Commit 4e6fcc4

Browse files
committed
Move HEAD_LOCK to while begin
1 parent 7a1a889 commit 4e6fcc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/pystate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,11 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
792792
// Clear the current/main thread state last.
793793
INTERP_HEAD_LOCK(interp);
794794
PyThreadState *p = interp->threads.head;
795+
HEAD_UNLOCK(&_PyRuntime);
795796
while (p != NULL) {
796797
// See https://github.com/python/cpython/issues/102126
797798
// Must be called without HEAD_LOCK held as it can deadlock
798799
// if any finalizer tries to acquire that lock.
799-
HEAD_UNLOCK(&_PyRuntime);
800800
PyThreadState_Clear(p);
801801
p = p->next;
802802
}

0 commit comments

Comments
 (0)