]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
linecache.py was still struggling with unicode vs. non-unicode.
authorGuido van Rossum <guido@python.org>
Tue, 22 May 2007 00:12:45 +0000 (00:12 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 22 May 2007 00:12:45 +0000 (00:12 +0000)
Lib/linecache.py

index 9a16acd2599596af87e4d654c26c41823c91a166..77e3ab7197061d877b43c79c4eda7d1be7f1f0a3 100644 (file)
@@ -139,8 +139,9 @@ def updatecache(filename, module_globals=None):
             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