summaryrefslogtreecommitdiffstats
path: root/Lib/stat.py
diff options
context:
space:
mode:
authorRonan Lamy <ronan.lamy@gmail.com>2019-10-10 07:34:46 (GMT)
committerVictor Stinner <vstinner@python.org>2019-10-10 07:34:46 (GMT)
commit7bb14316b8ceddb813f31040a299af94a57ab339 (patch)
treedfac97d7fff7de61f580a9a1c59037d0788d2f83 /Lib/stat.py
parenta5447735c334a041ee2ffdeb5c7e13d7d4502ea2 (diff)
downloadcpython-7bb14316b8ceddb813f31040a299af94a57ab339.zip
cpython-7bb14316b8ceddb813f31040a299af94a57ab339.tar.gz
cpython-7bb14316b8ceddb813f31040a299af94a57ab339.tar.bz2
bpo-38109: Add missing constants to Lib/stat.py (GH-16665)
Add missing stat.S_IFDOOR, stat.S_IFPORT, stat.S_IFWHT, stat.S_ISDOOR, stat.S_ISPORT, and stat.S_ISWHT values to the Python implementation of the stat module.
Diffstat (limited to 'Lib/stat.py')
-rw-r--r--Lib/stat.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/stat.py b/Lib/stat.py
index a9c678e..fc024db 100644
--- a/Lib/stat.py
+++ b/Lib/stat.py
@@ -40,6 +40,10 @@ S_IFREG = 0o100000 # regular file
S_IFIFO = 0o010000 # fifo (named pipe)
S_IFLNK = 0o120000 # symbolic link
S_IFSOCK = 0o140000 # socket file
+# Fallbacks for uncommon platform-specific constants
+S_IFDOOR = 0
+S_IFPORT = 0
+S_IFWHT = 0
# Functions to test for each file type
@@ -71,6 +75,18 @@ def S_ISSOCK(mode):
"""Return True if mode is from a socket."""
return S_IFMT(mode) == S_IFSOCK
+def S_ISDOOR(mode):
+ """Return True if mode is from a door."""
+ return False
+
+def S_ISPORT(mode):
+ """Return True if mode is from an event port."""
+ return False
+
+def S_ISWHT(mode):
+ """Return True if mode is from a whiteout."""
+ return False
+
# Names for permission bits
S_ISUID = 0o4000 # set UID bit