Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ae7c4a0a
Commit
ae7c4a0a
authored
Apr 22, 2009
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #5170: Fixed regression caused when fixing #5768.
parent
6b678463
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
Lib/logging/__init__.py
Lib/logging/__init__.py
+11
-1
No files found.
Lib/logging/__init__.py
View file @
ae7c4a0a
...
@@ -766,7 +766,17 @@ class StreamHandler(Handler):
...
@@ -766,7 +766,17 @@ class StreamHandler(Handler):
try
:
try
:
if
(
isinstance
(
msg
,
unicode
)
and
if
(
isinstance
(
msg
,
unicode
)
and
getattr
(
stream
,
'encoding'
,
None
)):
getattr
(
stream
,
'encoding'
,
None
)):
stream
.
write
(
fs
.
decode
(
stream
.
encoding
)
%
msg
)
fs
=
fs
.
decode
(
stream
.
encoding
)
try
:
stream
.
write
(
fs
%
msg
)
except
UnicodeEncodeError
:
#Printing to terminals sometimes fails. For example,
#with an encoding of 'cp1251', the above write will
#work if written to a stream opened or wrapped by
#the codecs module, but fail when writing to a
#terminal even when the codepage is set to cp1251.
#An extra encoding step seems to be needed.
stream
.
write
((
fs
%
msg
).
encode
(
stream
.
encoding
))
else
:
else
:
stream
.
write
(
fs
%
msg
)
stream
.
write
(
fs
%
msg
)
except
UnicodeError
:
except
UnicodeError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment