On 10 Jul 2014 03:39, "Victor Stinner" <victor.stin...@gmail.com> wrote: > > 2014-07-10 9:04 GMT+02:00 Paul Moore <p.f.mo...@gmail.com>: > > As someone (Tim?) pointed out later in the thread, > > FindFirstFile/FindNextFile doesn't follow symlinks by default (and nor > > do the dirent entries on Unix). So whether or not it's "natural", the > > "free" functionality provided by the OS is that of lstat, not that of > > stat. Presumably because it's possible to build symlink-following code > > on top of non-following code, but not the other way around. > > DirEntry methods will remain free (no syscall) for directories and > regular files. One extra syscall will be needed only for symlinks, > which are more rare than other file types (for example, you wrote " > Windows typically makes little use of symlinks").
The info we want for scandir is that of the *link itself*. That makes it easy to implement things like the "followlinks" flag of os.walk. The *far end* of the link isn't relevant at this level. The docs just need to be clear that DirEntry objects always match lstat(), never stat(). Cheers, Nick. > > See my pseudo-code: > https://mail.python.org/pipermail/python-dev/2014-July/135439.html > > On Windows, _lstat and _stat attributes will be filled directly in the > constructor on Windows for regular files and directories. > > Victor > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com