mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
eccd02a40d
commit
384fd106e8
2 changed files with 11 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue