diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 2f081a0a85e..aaad89884f1 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1627,6 +1627,7 @@ def shutdown(handlerList=_handlerList): h = wr() if h: try: + h.acquire() h.flush() h.close() except (IOError, ValueError): @@ -1635,6 +1636,8 @@ def shutdown(handlerList=_handlerList): # references to them are still around at # application exit. pass + finally: + h.release() except: if raiseExceptions: raise