mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Closes #13232: Handle multiple encodings in exception logging.
This commit is contained in:
parent
99e93d2dde
commit
9a11b296b2
1 changed files with 6 additions and 2 deletions
|
@ -478,8 +478,12 @@ class Formatter(object):
|
|||
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())
|
||||
# See issue 8924.
|
||||
# We also use replace for when there are multiple
|
||||
# encodings, e.g. UTF-898 for the filesystem and latin-1
|
||||
# for a script. See issue 13232.
|
||||
s = s + record.exc_text.decode(sys.getfilesystemencoding(),
|
||||
'replace')
|
||||
return s
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue