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

index d9ac7d9c131f3893f5f3919f0a272170079b03f6,685efeb4a887e9ef2e0a09c8264d011afcf320af..e4b34a1af73fa6b0742f8f67468b398c951c956f
@@@ -1790,17 -1507,9 +1790,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