Kaydet (Commit) 78f43a73 authored tarafından Victor Stinner's avatar Victor Stinner

linecache.updatecache() returns an empty list on error

lines variable was not set on IOError
üst d68d4e8e
...@@ -128,7 +128,7 @@ def updatecache(filename, module_globals=None): ...@@ -128,7 +128,7 @@ def updatecache(filename, module_globals=None):
with open(fullname, 'r', encoding=coding) as fp: with open(fullname, 'r', encoding=coding) as fp:
lines = fp.readlines() lines = fp.readlines()
except IOError: except IOError:
pass lines = []
if lines and not lines[-1].endswith('\n'): if lines and not lines[-1].endswith('\n'):
lines[-1] += '\n' lines[-1] += '\n'
size, mtime = stat.st_size, stat.st_mtime size, mtime = stat.st_size, stat.st_mtime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment