mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
SF #737473: Show up-to-date source code in tracebacks always.
And add an optional argument 'filename' to linecache.checkcache() to enable checking caches per-file.
This commit is contained in:
parent
23109ef11e
commit
182ac85147
5 changed files with 60 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue