From: Vinay Sajip Date: Tue, 8 Mar 2011 22:47:18 +0000 (+0000) Subject: Issue #11444: Merge fix from 2.6. X-Git-Tag: v2.7.2rc1~266 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee145ecc5fdcbb23152407fc76dac8f6aa886c3f;p=python Issue #11444: Merge fix from 2.6. --- ee145ecc5fdcbb23152407fc76dac8f6aa886c3f diff --cc Lib/logging/__init__.py index 2f081a0a85,a3b3e391ec..aaad89884f --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@@ -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