Does this (untested) code make sense as a possible addition to statcache? One obvious problem I see is that if stat(path) had been called before lstat(path), you'd pull the wrong info out of the cache. You could get around this by maintaining separate stat and lstat caches or caching a different key (e.g. (path, "l")) for the lstat variety. If this is deemed worthwhile I'll make it work and submit a patch to SF. I wanted to check first to make sure I wasn't missing something obvious that would keep it from ever working. Skip *** /tmp/skip/statcache.py.~1.11~fVASKs Wed Oct 31 13:10:22 2001 --- /tmp/skip/statcache.pyfVAfUy Wed Oct 31 13:10:22 2001 *************** *** 6,12 **** import os as _os from stat import * ! __all__ = ["stat","reset","forget","forget_prefix","forget_dir", "forget_except_prefix","isdir"] # The cache. Keys are pathnames, values are os.stat outcomes. --- 6,12 ---- import os as _os from stat import * ! __all__ = ["stat","lstat","reset","forget","forget_prefix","forget_dir", "forget_except_prefix","isdir"] # The cache. Keys are pathnames, values are os.stat outcomes. *************** *** 22,27 **** --- 22,37 ---- if ret is None: cache[path] = ret = _os.stat(path) return ret + + if hasattr(_os, "lstat"): + def lstat(path): + """Lstat a file, possibly out of the cache.""" + ret = cache.get(path, None) + if ret is None: + cache[path] = ret = _os.lstat(path) + return ret + else: + lstat = stat def reset(): """Clear the cache."""