mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
Issue #23838: linecache now clears the cache and returns an empty result on
MemoryError.
This commit is contained in:
parent
263dcd20a3
commit
c512adc90d
3 changed files with 24 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue