os.access now returns True on Windows for any existing directory.
diff --git a/Misc/NEWS b/Misc/NEWS
index 7172f83..735b073 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,8 @@
Library
-------
+- os.access now returns True on Windows for any existing directory.
+
- Issue #1531: tarfile.py: Read fileobj from the current offset, do not
seek to the start.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 215930f..aaaa838 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1535,8 +1535,11 @@
/* 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",