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

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


http://hg.python.org/cpython/rev/16f8f359db9c
changeset:   68335:16f8f359db9c
branch:      3.1
parent:      68323:a7e0cff05597
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Tue Mar 08 22:49:57 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
@@ -1507,12 +1507,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