rpms/python/F-11 python-2.6.logging_fix.patch, NONE, 1.1 python.spec, 1.147, 1.148
James Antill
james at fedoraproject.org
Mon Jun 8 20:02:00 UTC 2009
Author: james
Update of /cvs/pkgs/rpms/python/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20984
Modified Files:
python.spec
Added Files:
python-2.6.logging_fix.patch
Log Message:
* Mon Jun 8 2009 James Antill <james at fedoraproject.org> 2.6-9
- Import upstream fixes for logging unicode, revisions 71658 and 71795.
- Resolves: bug#504407
python-2.6.logging_fix.patch:
--- NEW FILE python-2.6.logging_fix.patch ---
diff -ru Python-2.6-orig/Lib/logging/__init__.py Python-2.6/Lib/logging/__init__.py
--- Python-2.6-orig/Lib/logging/__init__.py 2008-09-04 03:31:21.000000000 -0400
+++ Python-2.6/Lib/logging/__init__.py 2009-06-08 15:57:30.000000000 -0400
@@ -752,17 +752,29 @@
"""
try:
msg = self.format(record)
+ stream = self.stream
fs = "%s\n"
if not hasattr(types, "UnicodeType"): #if no unicode support...
- self.stream.write(fs % msg)
+ stream.write(fs % msg)
else:
try:
- if getattr(self.stream, 'encoding', None) is not None:
- self.stream.write(fs % msg.encode(self.stream.encoding))
+ if (isinstance(msg, unicode) and
+ getattr(stream, 'encoding', None)):
+ 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:
- self.stream.write(fs % msg)
+ stream.write(fs % msg)
except UnicodeError:
- self.stream.write(fs % msg.encode("UTF-8"))
+ stream.write(fs % msg.encode("UTF-8"))
self.flush()
except (KeyboardInterrupt, SystemExit):
raise
Only in Python-2.6/Lib/logging: __init__.py~
Index: python.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python/F-11/python.spec,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -p -r1.147 -r1.148
--- python.spec 16 Apr 2009 00:07:20 -0000 1.147
+++ python.spec 8 Jun 2009 20:01:29 -0000 1.148
@@ -22,7 +22,7 @@
Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
Version: 2.6
-Release: 8%{?dist}
+Release: 9%{?dist}
License: Python
Group: Development/Languages
Provides: python-abi = %{pybasever}
@@ -53,6 +53,7 @@ Patch51: python-2.6-distutils_rpm.patch
# upstreamed
#Patch50: python-2.5-disable-egginfo.patch
+Patch52: python-2.6.logging_fix.patch
# new db version
#Patch60: python-2.5.2-db47.patch
@@ -228,6 +229,7 @@ code that uses more than just unittest a
%patch16 -p1 -b .rpath
%patch51 -p1 -b .brprpm
+%patch52 -p1 -b .logfix
%ifarch alpha ia64
# 64bit, but not lib64 arches need this too...
@@ -535,6 +537,10 @@ rm -fr $RPM_BUILD_ROOT
%{_libdir}/python%{pybasever}/lib-dynload/_testcapimodule.so
%changelog
+* Mon Jun 8 2009 James Antill <james at fedoraproject.org> 2.6-9
+- Import upstream fixes for logging unicode, revisions 71658 and 71795.
+- Resolves: bug#504407
+
* Wed Apr 15 2009 Ignacio Vazquez-Abrams <ivazqueznet+rpm at gmail.com> 2.6-8
- Replace python-hashlib and python-uuid (#484715)
More information about the fedora-extras-commits
mailing list