STINNER Victor added the comment:

> BTW, with respect to changeset 2b25fa7e3b7a, I'm not sure it has quite the 
> right semantics for is_dir, at least not if it's supposed to parallel 
> os.path.isdir().  I believe that should return True for a symbolic link to a 
> directory, which it doesn't look like this change would, if is_symlink 
> happened to have been called first.  It's possible the semantics of how 
> _DummyDirEntry is used precludes that scenario, but it seems a little 
> fragile.  I'd probably just use lstat() for is_symlink, but otherwise not 
> touch is_dir.

I think that you misunderstood the code. The "use cache lstat" path is only 
taken if the file is *not* symbolic link.

I tested manually _DummyDirEntry on a symbolic link to a directory: _lstat is 
filled by the constructor, is_dir() *and* is_symlink() returns True. Both are 
not exclusive, is_dir() works as follow_symlinks=True, whereas is_symlink() 
works as follow_symlinks=False.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25911>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to