Issue #23838: linecache now clears the cache and returns an empty result on

MemoryError.
This commit is contained in:
Serhiy Storchaka 2015-04-01 16:54:05 +03:00
parent 263dcd20a3
commit c512adc90d
3 changed files with 24 additions and 4 deletions

View file

@ -37,8 +37,12 @@ def getlines(filename, module_globals=None):
if filename in cache:
return cache[filename][2]
else:
try:
return updatecache(filename, module_globals)
except MemoryError:
clearcache()
return []
def checkcache(filename=None):