summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-05-09 12:11:30 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-05-09 12:11:30 (GMT)
commit28274ab6cf89e60054c44d6fb1174cc02306dc74 (patch)
tree8acd3052ff5e4d5c346d1033e27d447633122891
parent26f325577485c93bc7e297001d7f088f90767bb7 (diff)
downloadcpython-28274ab6cf89e60054c44d6fb1174cc02306dc74.zip
cpython-28274ab6cf89e60054c44d6fb1174cc02306dc74.tar.gz
cpython-28274ab6cf89e60054c44d6fb1174cc02306dc74.tar.bz2
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
-rw-r--r--Lib/logging/__init__.py8
-rw-r--r--Misc/NEWS3
2 files changed, 9 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 7cddd9f..c1678b7 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -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):
"""
diff --git a/Misc/NEWS b/Misc/NEWS
index 361950b..0717458 100644
--- 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.