On Tue, Oct 20, 2020, at 07:42, Steve Dower wrote:
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).
ok, see, the correction you posted doesn't address the part of your claim that people are taking issue with, which is that *calling os.stat() causes the atime to be set to the time of the call to os.stat()*. This is not the same thing as [correctly] saying that "calling os.stat() may return a more up-to-date atime, the time of the last read, write, or other operation", and the phrasing "updates the access time to _now_" certainly *seemed* unambiguous. And at this point it's not clear to me whether you understand that people are reading your claim this way. What correction, exactly, do you mean? The post I saw with the word "Correction" on it is the one that *makes* the claim people are taking issue with.