[Python-checkins] r76754 - in python: branches/py3k branches/release24-maint branches/release25-maint branches/release26-maint trunk/Lib/logging/__init__.py trunk/Misc/NEWS
vinay.sajip
python-checkins at python.org
Fri Dec 11 10:16:02 CET 2009
Author: vinay.sajip
Date: Fri Dec 11 10:16:01 2009
New Revision: 76754
Log:
Issue #7470: logging: fix bug in Unicode encoding fallback.
Modified:
python/branches/py3k/ (props changed)
python/branches/release24-maint/ (props changed)
python/branches/release25-maint/ (props changed)
python/branches/release26-maint/ (props changed)
python/trunk/Lib/logging/__init__.py
python/trunk/Misc/NEWS
Modified: python/trunk/Lib/logging/__init__.py
==============================================================================
--- python/trunk/Lib/logging/__init__.py (original)
+++ python/trunk/Lib/logging/__init__.py Fri Dec 11 10:16:01 2009
@@ -821,9 +821,9 @@
try:
if (isinstance(msg, unicode) and
getattr(stream, 'encoding', None)):
- fs = fs.decode(stream.encoding)
+ ufs = fs.decode(stream.encoding)
try:
- stream.write(fs % msg)
+ stream.write(ufs % msg)
except UnicodeEncodeError:
#Printing to terminals sometimes fails. For example,
#with an encoding of 'cp1251', the above write will
@@ -831,7 +831,7 @@
#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))
+ stream.write((ufs % msg).encode(stream.encoding))
else:
stream.write(fs % msg)
except UnicodeError:
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Dec 11 10:16:01 2009
@@ -15,6 +15,8 @@
Library
-------
+- Issue #7470: logging: fix bug in Unicode encoding fallback.
+
- Issue #5949: fixed IMAP4_SSL hang when the IMAP server response is
missing proper end-of-line termination.
More information about the Python-checkins
mailing list