[Python-3000-checkins] r55811 - python/branches/py3k-struni/Lib/platform.py

walter.doerwald python-3000-checkins at python.org
Thu Jun 7 21:26:28 CEST 2007


Author: walter.doerwald
Date: Thu Jun  7 21:26:24 2007
New Revision: 55811

Modified:
   python/branches/py3k-struni/Lib/platform.py
Log:
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).


Modified: python/branches/py3k-struni/Lib/platform.py
==============================================================================
--- python/branches/py3k-struni/Lib/platform.py	(original)
+++ python/branches/py3k-struni/Lib/platform.py	Thu Jun  7 21:26:24 2007
@@ -145,12 +145,12 @@
         # 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


More information about the Python-3000-checkins mailing list