Author: guido.van.rossum
Date: Tue May 22 02:12:45 2007
New Revision: 55499

Modified:
   python/branches/py3k-struni/Lib/linecache.py
Log:
linecache.py was still struggling with unicode vs. non-unicode.


Modified: python/branches/py3k-struni/Lib/linecache.py
==============================================================================
--- python/branches/py3k-struni/Lib/linecache.py        (original)
+++ python/branches/py3k-struni/Lib/linecache.py        Tue May 22 02:12:45 2007
@@ -139,8 +139,9 @@
             coding = m.group(1)
             break
     try:
-        lines = [unicode(line, coding) for line in lines]
-    except UnicodeError:
+        lines = [line if isinstance(line, str) else str(line, coding)
+                 for line in lines]
+    except:
         pass  # Hope for the best
     size, mtime = stat.st_size, stat.st_mtime
     cache[filename] = size, mtime, lines, fullname
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to