From 7c28d2c61c81676b361ec69972820588e2eeed31 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 15 Mar 2013 14:25:57 -0700 Subject: [PATCH] Fix error in platform.platform() when non-ascii byte strings are decoded to unicode (rhbz#922149) --- ...00174-upstream-issue16754-so-extension.patch | 0 00175-platform-unicode.patch | 13 +++++++++++++ python3.spec | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) rename python3-upstream-issue16754-so-extension.patch => 00174-upstream-issue16754-so-extension.patch (100%) create mode 100644 00175-platform-unicode.patch diff --git a/python3-upstream-issue16754-so-extension.patch b/00174-upstream-issue16754-so-extension.patch similarity index 100% rename from python3-upstream-issue16754-so-extension.patch rename to 00174-upstream-issue16754-so-extension.patch diff --git a/00175-platform-unicode.patch b/00175-platform-unicode.patch new file mode 100644 index 0000000..7d847e1 --- /dev/null +++ b/00175-platform-unicode.patch @@ -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) + diff --git a/python3.spec b/python3.spec index 4c74e0c..78e558d 100644 --- a/python3.spec +++ b/python3.spec @@ -545,7 +545,15 @@ Patch173: 00173-workaround-ENOPROTOOPT-in-bind_port.patch # Potential patch for so extensions being wrong since SOABI in upstream python3. # http://bugs.python.org/issue16754 # (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 ^^^) # @@ -794,6 +802,7 @@ done #00172: TODO %patch173 -p1 %patch174 -p1 +%patch175 -p1 # 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. @@ -1650,7 +1659,11 @@ rm -fr %{buildroot} # ====================================================== %changelog -* Thu Mar 14 2013 Toshio Kuratomi - .0-7 +* Fri Mar 15 2013 Toshio Kuratomi - 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 - 3.3.0-7 - Fix up shared library extension (rhbz#889784) * Thu Mar 07 2013 Karsten Hopp 3.3.0-6