]> granicus.if.org Git - python/commitdiff
Issue #11444: Lock handlers while flushing/closing during shutdown.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 8 Mar 2011 22:39:55 +0000 (22:39 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 8 Mar 2011 22:39:55 +0000 (22:39 +0000)
Lib/logging/__init__.py

index b48bee85bd07bfe1a52e59417227f31ee742bb8b..a3b3e391ec3fcc3e058e2622639888bdd90ae19f 100644 (file)
@@ -1513,12 +1513,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: