mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
linecache.updatecache() returns an empty list on error
lines variable was not set on IOError
This commit is contained in:
parent
d68d4e8e42
commit
78f43a73cb
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue