From: Vinay Sajip Date: Tue, 8 Mar 2011 22:49:57 +0000 (+0000) Subject: Issue #11444: Lock handlers while flushing/closing during shutdown. X-Git-Tag: v3.2.1b1~334^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8ab6eeb01ef01d8a630cbf177b06cece326be54;p=thirdparty%2FPython%2Fcpython.git Issue #11444: Lock handlers while flushing/closing during shutdown. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index b555bbefd3d0..685efeb4a887 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1507,12 +1507,15 @@ def shutdown(handlerList=_handlerList): #errors might occur, for example, if files are locked #we just ignore them if raiseExceptions is not set try: + h.acquire() h.flush() h.close() except: if raiseExceptions: raise #else, swallow + finally: + h.release() #Let's try and shutdown automatically on application exit... try: