From 384fd106e89ec859ace7c098620aad8ce2c2abaa Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Sun, 21 Jan 2001 03:40:37 +0000 Subject: Bug #128475: mimetools.encode (sometimes) fails when called from a thread. pythonrun.c: In Py_Finalize, don't reset the initialized flag until after the exit funcs have run. atexit.py: in _run_exitfuncs, mutate the list of pending calls in a threadsafe way. This wasn't a contributor to bug 128475, it just burned my eyeballs when looking at that bug. --- Lib/atexit.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Lib/atexit.py') diff --git a/Lib/atexit.py b/Lib/atexit.py index bcf7e548a0..61f2458dd0 100644 --- a/Lib/atexit.py +++ b/Lib/atexit.py @@ -16,9 +16,8 @@ def _run_exitfuncs(): """ while _exithandlers: - func, targs, kargs = _exithandlers[-1] + func, targs, kargs = _exithandlers.pop() apply(func, targs, kargs) - _exithandlers.remove(_exithandlers[-1]) def register(func, *targs, **kargs): """register a function to be executed upon normal program termination -- cgit v1.2.1