Commit 29d8a45d authored by Vinay Sajip's avatar Vinay Sajip

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

parent 67ec75d3
...@@ -445,7 +445,13 @@ class Formatter: ...@@ -445,7 +445,13 @@ class Formatter:
if record.exc_text: if record.exc_text:
if s[-1:] != "\n": if s[-1:] != "\n":
s = s + "\n" s = s + "\n"
try:
s = s + record.exc_text 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 return s
# #
......
...@@ -71,6 +71,8 @@ C-API ...@@ -71,6 +71,8 @@ C-API
Library Library
------- -------
- Issue #8924: logging: Improved error handling for Unicode in exception text.
- Fix codecs.escape_encode to return the correct consumed size. - Fix codecs.escape_encode to return the correct consumed size.
- Issue #6470: Drop UNC prefix in FixTk. - Issue #6470: Drop UNC prefix in FixTk.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment