Mercurial > cpython-lru_cache-weakref
diff Lib/linecache.py @ 41811:d07d34b53db5
linecache.py was still struggling with unicode vs. non-unicode.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 22 May 2007 00:12:45 +0000 |
| parents | a3248fefc0dc |
| children | 91ade67ab230 |
line wrap: on
line diff
--- a/Lib/linecache.py Tue May 22 00:10:22 2007 +0000 +++ b/Lib/linecache.py Tue May 22 00:12:45 2007 +0000 @@ -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
