summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1990-10-21 16:17:34 (GMT)
committerGuido van Rossum <guido@python.org>1990-10-21 16:17:34 (GMT)
commit40d9304d66edcab3925c75e9d8ad093562cf5d7b (patch)
tree3bc446bca5a87b869635865bb2f1e97b0b33116b /Lib/posixpath.py
parent6b47ed1f9d21371b33d5a46615edef8b61ac4a94 (diff)
downloadcpython-40d9304d66edcab3925c75e9d8ad093562cf5d7b.zip
cpython-40d9304d66edcab3925c75e9d8ad093562cf5d7b.tar.gz
cpython-40d9304d66edcab3925c75e9d8ad093562cf5d7b.tar.bz2
Use 'stat' module instead of hardcoding information from <sys/stat.h>.
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r--Lib/posixpath.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index e314cb3..0c0d09f 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -1,6 +1,7 @@
# Module 'path' -- common operations on POSIX pathnames
import posix
+import stat
# Intelligent pathname concatenation.
@@ -63,7 +64,7 @@ def isdir(path):
st = posix.stat(path)
except posix.error:
return 0
- return st[0] / 4096 = 4 # S_IFDIR
+ return stat.S_ISDIR(st[stat.ST_MODE])
# Is a path a symbolic link?
@@ -74,7 +75,7 @@ def islink(path):
st = posix.lstat(path)
except (posix.error, NameError):
return 0
- return st[0] / 4096 = 10 # S_IFLNK
+ return stat.S_ISLNK(st[stat.ST_MODE])
_mounts = []