summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-22 00:12:45 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-22 00:12:45 (GMT)
commit94ca1c620ebc63b0860579835f2c16fe056e1225 (patch)
treef34745d022c99095896bc2ec4cbddbdef38575c5
parent390bd7c67e4521bfcf8c923b6d8922881555b627 (diff)
downloadcpython-94ca1c620ebc63b0860579835f2c16fe056e1225.zip
cpython-94ca1c620ebc63b0860579835f2c16fe056e1225.tar.gz
cpython-94ca1c620ebc63b0860579835f2c16fe056e1225.tar.bz2
linecache.py was still struggling with unicode vs. non-unicode.
-rw-r--r--Lib/linecache.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index 9a16acd..77e3ab7 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -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