]> granicus.if.org Git - python/commitdiff
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 9 May 2009 12:11:30 +0000 (12:11 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 9 May 2009 12:11:30 +0000 (12:11 +0000)
Lib/logging/__init__.py
Misc/NEWS

index 7cddd9fd33868bc851cfa7c13913fd0d0ac2e8d9..c1678b79e2dfd2cfb65c171ffc622b14277e2a5f 100644 (file)
@@ -720,8 +720,12 @@ class Handler(Filterer):
         """
         if raiseExceptions:
             ei = sys.exc_info()
-            traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
-            del ei
+            try:
+                traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
+            except IOError:
+                pass    # see issue 5971
+            finally:
+                del ei
 
 class StreamHandler(Handler):
     """
index 361950b95d05dd7167ca08b09262e0f3008c5fd1..07174581486889d668beccacd05bdc442eaffc8f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when
+  trying to print a traceback.
+
 - Issue 5955: aifc's close method did not close the file it wrapped,
   now it does.  This also means getfp method now returns the real fp.