Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41a64a5

Browse files
author
Victor Stinner
committed
linecache.updatecache(): don't the lines into the cache on IOError
Use the same behaviour than Python 2.7.
1 parent 78f43a7 commit 41a64a5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/linecache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def updatecache(filename, module_globals=None):
128128
with open(fullname, 'r', encoding=coding) as fp:
129129
lines = fp.readlines()
130130
except IOError:
131-
lines = []
131+
return []
132132
if lines and not lines[-1].endswith('\n'):
133133
lines[-1] += '\n'
134134
size, mtime = stat.st_size, stat.st_mtime

0 commit comments

Comments
 (0)