gh-101196: Make isdir/isfile/exists faster on Windows (GH-101324)

Co-authored-by: Eryk Sun <eryksun@gmail.com>
This commit is contained in:
Michael Droettboom 2023-02-08 09:34:24 -05:00 committed by GitHub
parent 3a88de7a0a
commit 86ebd5c3fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 624 additions and 34 deletions

View file

@ -187,18 +187,6 @@ def dirname(p):
return head
# Is a path a symbolic link?
# This will always return false on systems where os.lstat doesn't exist.
def islink(path):
"""Test whether a path is a symbolic link"""
try:
st = os.lstat(path)
except (OSError, ValueError, AttributeError):
return False
return stat.S_ISLNK(st.st_mode)
# Is a path a junction?
def isjunction(path):