From: Victor Stinner Date: Wed, 29 Sep 2010 01:30:45 +0000 (+0000) Subject: linecache.updatecache(): don't the lines into the cache on IOError X-Git-Tag: v3.2a3~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41a64a53a30f2d81de7b4a05e5e8e9b4089f7ca7;p=thirdparty%2FPython%2Fcpython.git linecache.updatecache(): don't the lines into the cache on IOError Use the same behaviour than Python 2.7. --- diff --git a/Lib/linecache.py b/Lib/linecache.py index f0bb83d1d80e..974b1d965ab5 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