Fix error in platform.platform() when non-ascii byte strings are decoded to
unicode (rhbz#922149)
This commit is contained in:
parent
e7214707e2
commit
7c28d2c61c
3 changed files with 28 additions and 2 deletions
13
00175-platform-unicode.patch
Normal file
13
00175-platform-unicode.patch
Normal 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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue