summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-06-07 19:26:24 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-06-07 19:26:24 (GMT)
commitc3b6ac796f160ed27d2d1094ef606514ac3ae898 (patch)
treedcb518a7f161a1986fcbb2849b546a850d831bfc /Lib
parent94093ffcb68f79180c35b1c651738194a97a1bcb (diff)
downloadcpython-c3b6ac796f160ed27d2d1094ef606514ac3ae898.zip
cpython-c3b6ac796f160ed27d2d1094ef606514ac3ae898.tar.gz
cpython-c3b6ac796f160ed27d2d1094ef606514ac3ae898.tar.bz2
Fix libc_ver(): libc_ver() was reading sys.executable
in binary mode and comparing the content to strings, which failed. Now the bytes get decoded into unicode using latin-1 (the comparison compares ASCII strings only anyway, and we don't want the decoding to fail).
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/platform.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index ed5d22d..bd9efe6 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -145,12 +145,12 @@ def libc_ver(executable=sys.executable,lib='',version='',
# able to open symlinks for reading
executable = os.path.realpath(executable)
f = open(executable,'rb')
- binary = f.read(chunksize)
+ binary = f.read(chunksize).decode('latin-1')
pos = 0
while 1:
m = _libc_search.search(binary,pos)
if not m:
- binary = f.read(chunksize)
+ binary = f.read(chunksize).decode('latin-1')
if not binary:
break
pos = 0