summaryrefslogtreecommitdiffstats
path: root/Lib/linecache.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r--Lib/linecache.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index 6e65c37..3afcce1 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -40,11 +40,14 @@ def getlines(filename, module_globals=None):
if filename in cache:
entry = cache[filename]
- if len(entry) == 1:
- return updatecache(filename, module_globals)
- return cache[filename][2]
- else:
+ if len(entry) != 1:
+ return cache[filename][2]
+
+ try:
return updatecache(filename, module_globals)
+ except MemoryError:
+ clearcache()
+ return []
def checkcache(filename=None):