summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-12-03 23:09:04 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-12-03 23:09:04 (GMT)
commit7b3cc06a9a26e38f379ac802e857a463970e35fa (patch)
treecfd664684b43fbe8966de87709d51c185164071a /Modules
parente227263a6c4b4f7152553d9df89175b67dfcef4a (diff)
downloadcpython-7b3cc06a9a26e38f379ac802e857a463970e35fa.zip
cpython-7b3cc06a9a26e38f379ac802e857a463970e35fa.tar.gz
cpython-7b3cc06a9a26e38f379ac802e857a463970e35fa.tar.bz2
Forward-port r59310:
os.access now returns True on Windows for any existing directory.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ff79a0e..df15860 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1540,8 +1540,11 @@ finish:
/* File does not exist, or cannot read attributes */
return PyBool_FromLong(0);
/* Access is possible if either write access wasn't requested, or
- the file isn't read-only. */
- return PyBool_FromLong(!(mode & 2) || !(attr & FILE_ATTRIBUTE_READONLY));
+ the file isn't read-only, or if it's a directory, as there are
+ no read-only directories on Windows. */
+ return PyBool_FromLong(!(mode & 2)
+ || !(attr & FILE_ATTRIBUTE_READONLY)
+ || (attr & FILE_ATTRIBUTE_DIRECTORY));
#else
int res;
if (!PyArg_ParseTuple(args, "eti:access",