summaryrefslogtreecommitdiffstats
path: root/Lib/linecache.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r--Lib/linecache.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index 1b70c7c..2ccc6c6 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -40,11 +40,19 @@ def getlines(filename):
return updatecache(filename)
-def checkcache():
+def checkcache(filename=None):
"""Discard cache entries that are out of date.
(This is not checked upon each call!)"""
- for filename in cache.keys():
+ if filename is None:
+ filenames = cache.keys()
+ else:
+ if filename in cache:
+ filenames = [filename]
+ else:
+ return
+
+ for filename in filenames:
size, mtime, lines, fullname = cache[filename]
try:
stat = os.stat(fullname)