Nicolas Lehuen wrote ..
> OK, I've changed cache.py so that it uses stat() then open() the file
> if it needs to be reloaded. I've also added a unit test that makes
> sure the module cache is behaving as expected.
> 
> Graham, I don't think the stat() / open() / fstat() sequence is
> required. How would that improve accuracy ?

Depends on how precise you want to be. Technically the file could be
modified in that microsecond between when you do the stat and when
you open the file. I am probably being too pedantic. The worst that
would happen if you only do stat()/open() is that on the next access
to that resource, then the new mtime will be detected and it will be
loaded again. Frankly though we are talking about a one in bazillion
event, so grant that it isn't really required to do the fstat().

Graham

Reply via email to