diff options
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rw-r--r-- | Modules/posixmodule.c | 7 |
2 files changed, 7 insertions, 2 deletions
@@ -310,6 +310,8 @@ Core and builtins Library ------- +- os.access now returns True on Windows for any existing directory. + - Issue #1727780: Support loading pickles of random.Random objects created on 32-bit systems on 64-bit systems, and vice versa. As a consequence of the change, Random pickles created by Python 2.6 cannot be loaded 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", |