From: Vinay Sajip Date: Tue, 8 Mar 2011 22:53:21 +0000 (+0000) Subject: Issue #11444: Merge fix from 3.1. X-Git-Tag: v3.2.1b1~334 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9512e9ac11cb6b22669d7c06a321dbeb56ec0f5;p=python Issue #11444: Merge fix from 3.1. --- d9512e9ac11cb6b22669d7c06a321dbeb56ec0f5 diff --cc Lib/logging/__init__.py index d9ac7d9c13,685efeb4a8..e4b34a1af7 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@@ -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