Skip to content

Commit 8b87014

Browse files
committed
Improve comments.
1 parent 8c12e6c commit 8b87014

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Python/pylifecycle.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,9 +2095,9 @@ make_pre_finalization_calls(PyThreadState *tstate)
20952095
* Py_AddPendingCall() can be called without an attached thread state.
20962096
*/
20972097

2098+
PyMutex_Lock(&interp->ceval.pending.mutex);
20982099
// XXX Why does _PyThreadState_DeleteList() rely on all interpreters
20992100
// being stopped?
2100-
PyMutex_Lock(&interp->ceval.pending.mutex);
21012101
_PyEval_StopTheWorldAll(interp->runtime);
21022102
int should_continue = (interp_has_threads(interp)
21032103
|| interp_has_atexit_callbacks(interp)
@@ -2128,6 +2128,7 @@ _Py_Finalize(_PyRuntimeState *runtime)
21282128
// Block some operations.
21292129
tstate->interp->finalizing = 1;
21302130

2131+
// This call stops the world and takes the pending calls lock.
21312132
make_pre_finalization_calls(tstate);
21322133

21332134
/* Clean up any lingering subinterpreters.
@@ -2533,6 +2534,7 @@ Py_EndInterpreter(PyThreadState *tstate)
25332534
}
25342535
interp->finalizing = 1;
25352536

2537+
// This call stops the world and takes the pending calls lock.
25362538
make_pre_finalization_calls(tstate);
25372539

25382540
ASSERT_WORLD_STOPPED(interp);

0 commit comments

Comments
 (0)