]> granicus.if.org Git - python/commitdiff
Issue #11444: Merge fix from 2.6.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 8 Mar 2011 22:47:18 +0000 (22:47 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 8 Mar 2011 22:47:18 +0000 (22:47 +0000)
1  2 
Lib/logging/__init__.py

index 2f081a0a85ec309e18ae943f7dc88512680d5c7b,a3b3e391ec3fcc3e058e2622639888bdd90ae19f..aaad89884f18a3ecedea8467e4b329d0bc600f4e
@@@ -1624,17 -1513,9 +1624,20 @@@ 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()
 +            h = wr()
 +            if h:
 +                try:
++                    h.acquire()
 +                    h.flush()
 +                    h.close()
 +                except (IOError, ValueError):
 +                    # Ignore errors which might be caused
 +                    # because handlers have been closed but
 +                    # references to them are still around at
 +                    # application exit.
 +                    pass
++                finally:
++                    h.release()
          except:
              if raiseExceptions:
                  raise