]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #11444: Lock handlers while flushing/closing during shutdown.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 8 Mar 2011 22:49:57 +0000 (22:49 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 8 Mar 2011 22:49:57 +0000 (22:49 +0000)
Lib/logging/__init__.py

index b555bbefd3d0c5feea3551358f34874bc300b6e7..685efeb4a887e9ef2e0a09c8264d011afcf320af 100644 (file)
@@ -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: