Issue #8924: logging: Improved error handling for Unicode in exception text.

This commit is contained in:
Vinay Sajip 2010-06-11 22:56:50 +00:00
parent cca3a3f396
commit 936efc791a
2 changed files with 8 additions and 1 deletions

View File

@ -473,7 +473,13 @@ class Formatter(object):
if record.exc_text:
if s[-1:] != "\n":
s = s + "\n"
s = s + record.exc_text
try:
s = s + record.exc_text
except UnicodeError:
# Sometimes filenames have non-ASCII chars, which can lead
# to errors when s is Unicode and record.exc_text is str
# See issue 8924
s = s + record.exc_text.decode(sys.getfilesystemencoding())
return s
#

View File

@ -21,6 +21,7 @@ Core and Builtins
Library
-------
- Issue #8924: logging: Improved error handling for Unicode in exception text.
- Issue #8948: cleanup functions and class / module setups and teardowns are
now honored in unittest debug methods.