[Python-checkins] (2.6): Issue #11444: Lock handlers while flushing/closing during shutdown.

vinay.sajip python-checkins at python.org
Tue Mar 8 23:54:32 CET 2011


http://hg.python.org/cpython/rev/fc4d045e3170
changeset:   68333:fc4d045e3170
branch:      2.6
parent:      68315:b9d76846bb1c
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Tue Mar 08 22:39:55 2011 +0000
summary:
  Issue #11444: Lock handlers while flushing/closing during shutdown.

files:
  Lib/logging/__init__.py

diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1513,12 +1513,15 @@
         #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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list