[issue13645] import machinery vulnerable to timestamp collisions

Antoine Pitrou report at bugs.python.org
Fri Jan 13 18:09:16 CET 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> One is possibly deprecating path_mtime() so people don't waste time
> implementing it (we actually never need to remove it thanks to the
> ABC; otherwise we need to make sure the docs strongly state to only
> bother with path_stats()).

Ok, I saw I also forgot to update some importlib docs.

> The other is to say the mtime key should contain a value that is a
> real number (ie. float and any other numeric type that can cast to an
> integer).

Ok.

> And is there any efficient way to get the stat info on a file AND its
> contents in a single call?

I don't think so.  os.fstat() on an open fd looks minimally faster than
os.stat() on the filename (0.5µs faster here on Linux), but opening the
file has its own cost.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13645>
_______________________________________


More information about the Python-bugs-list mailing list