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
#
Library
-------
+- Issue #8924: logging: Improved error handling for Unicode in exception text.
+
- Fix codecs.escape_encode to return the correct consumed size.
- Issue #6470: Drop UNC prefix in FixTk.