Fix error in platform.platform() when non-ascii byte strings are decoded to

unicode (rhbz#922149)
This commit is contained in:
Toshio Kuratomi 2013-03-15 14:25:57 -07:00
parent e7214707e2
commit 7c28d2c61c
3 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1,13 @@
Index: Python-3.3.0/Lib/platform.py
===================================================================
--- Python-3.3.0.orig/Lib/platform.py
+++ Python-3.3.0/Lib/platform.py
@@ -331,7 +331,7 @@ def linux_distribution(distname='', vers
return _dist_try_harder(distname,version,id)
# Read the first line
- with open('/etc/'+file, 'r') as f:
+ with open('/etc/'+file, 'r', encoding='utf-8', errors='surrogateescape') as f:
firstline = f.readline()
_distname, _version, _id = _parse_release_file(firstline)

View File

@ -545,7 +545,15 @@ Patch173: 00173-workaround-ENOPROTOOPT-in-bind_port.patch
# Potential patch for so extensions being wrong since SOABI in upstream python3. # Potential patch for so extensions being wrong since SOABI in upstream python3.
# http://bugs.python.org/issue16754 # http://bugs.python.org/issue16754
# (rhbz#889784) # (rhbz#889784)
Patch174: python3-upstream-issue16754-so-extension.patch # Does not affect python2 (python2 does not have compiled extensions with the
# problematic information)
Patch174: 00174-upstream-issue16754-so-extension.patch
# Patch for potential unicode error when determining OS release names
# http://bugs.python.org/issue17429
# (rhbz#922149)
# Does not affect python2 (python2 uses a byte string so it doesn't need to decode)
Patch175: 00175-platform-unicode.patch
# (New patches go here ^^^) # (New patches go here ^^^)
# #
@ -794,6 +802,7 @@ done
#00172: TODO #00172: TODO
%patch173 -p1 %patch173 -p1
%patch174 -p1 %patch174 -p1
%patch175 -p1
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
# are many differences between 2.6 and the Python 3 library. # are many differences between 2.6 and the Python 3 library.
@ -1650,7 +1659,11 @@ rm -fr %{buildroot}
# ====================================================== # ======================================================
%changelog %changelog
* Thu Mar 14 2013 Toshio Kuratomi <toshio@fedoraproject.org> - .0-7 * Fri Mar 15 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 3.3.0-8
- Fix error in platform.platform() when non-ascii byte strings are decoded to
unicode (rhbz#922149)
* Thu Mar 14 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 3.3.0-7
- Fix up shared library extension (rhbz#889784) - Fix up shared library extension (rhbz#889784)
* Thu Mar 07 2013 Karsten Hopp <karsten@redhat.com> 3.3.0-6 * Thu Mar 07 2013 Karsten Hopp <karsten@redhat.com> 3.3.0-6