diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-09-29 01:24:59 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-09-29 01:24:59 (GMT) |
commit | 78f43a73cb9f44e113730fd74b98d681843c8398 (patch) | |
tree | d855e1f9472b5a14237a371150dcd294f130083b /Lib/linecache.py | |
parent | d68d4e8e42012c048aabd14c6e239caac1c09ae6 (diff) | |
download | cpython-78f43a73cb9f44e113730fd74b98d681843c8398.zip cpython-78f43a73cb9f44e113730fd74b98d681843c8398.tar.gz cpython-78f43a73cb9f44e113730fd74b98d681843c8398.tar.bz2 |
linecache.updatecache() returns an empty list on error
lines variable was not set on IOError
Diffstat (limited to 'Lib/linecache.py')
-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 ef2adf5..f0bb83d 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: - pass + lines = [] if lines and not lines[-1].endswith('\n'): lines[-1] += '\n' size, mtime = stat.st_size, stat.st_mtime |