On 20Oct2020 0520, Rob Cliffe wrote:
On 19/10/2020 12:42, Steve Dower wrote:
On 15Oct2020 2239, Rob Cliffe via Python-Dev wrote:
TLDR: In os.scandir directory entries, atime is always a copy of
mtime rather than the actual access time.
Correction - os.stat() updates the access time to _now_, while
os.scandir() returns the last access time without updating it.
Eryk replied with a deeper explanation of the cause, but fundamentally
this is what you are seeing.
Feel free to file a bug, but we'll likely only add a vague note to the
docs about how Windows works here rather than changing anything. If
anything, we should probably fix os.stat() to avoid updating the
access time so that both functions behave the same, but that might be
too complicated.
Cheers,
Steve
Sorry - what you say does not match the behaviour I observe, which is that
Yes, I posted a correction already (immediately after sending the first
email).
What you are seeing is what Windows decided was the best approach. If
you want to avoid that, os.stat() will get the latest available
information. But I don't want to penalise people who don't need it by
slowing down their scandir calls unnecessarily.
A documentation patch to make this difference between os.stat() and
DirEntry even clearer would be fine.
Cheers,
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/NAR7LTW2XMBKAPKLVBQQFVK6EA4ZWQZP/
Code of Conduct: http://python.org/psf/codeofconduct/