We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5cc26fe commit 32e7415Copy full SHA for 32e7415
Modules/atexitmodule.c
@@ -120,10 +120,12 @@ void
120
_PyAtExit_Fini(PyInterpreterState *interp)
121
{
122
struct atexit_state *state = &interp->atexit;
123
- // Only one thread can call this, no need to lock it
+ // Only one thread can call this, but atexit_cleanup_locked() assumes
124
+ // that the lock is held, so let's hold it anyway.
125
_PyAtExit_ASSERT_UNLOCKED(state);
-
126
+ _PyAtExit_LOCK(state);
127
atexit_cleanup_locked(state);
128
+ _PyAtExit_UNLOCK(state);
129
PyMem_Free(state->callbacks);
130
state->callbacks = NULL;
131
0 commit comments