diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-09-29 01:30:45 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-09-29 01:30:45 (GMT) |
commit | 41a64a53a30f2d81de7b4a05e5e8e9b4089f7ca7 (patch) | |
tree | 511eef49886fd9929fe9b64369bfee0bbeaa067e | |
parent | 78f43a73cb9f44e113730fd74b98d681843c8398 (diff) | |
download | cpython-41a64a53a30f2d81de7b4a05e5e8e9b4089f7ca7.zip cpython-41a64a53a30f2d81de7b4a05e5e8e9b4089f7ca7.tar.gz cpython-41a64a53a30f2d81de7b4a05e5e8e9b4089f7ca7.tar.bz2 |
linecache.updatecache(): don't the lines into the cache on IOError
Use the same behaviour than Python 2.7.
-rw-r--r-- | Lib/linecache.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py index f0bb83d..974b1d9 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -128,7 +128,7 @@ def updatecache(filename, module_globals=None): with open(fullname, 'r', encoding=coding) as fp: lines = fp.readlines() except IOError: - lines = [] + return [] if lines and not lines[-1].endswith('\n'): lines[-1] += '\n' size, mtime = stat.st_size, stat.st_mtime |