Mercurial > cpython-lru_cache-weakref
diff Modules/posixmodule.c @ 44135:d75210bbca97 legacy-trunk
Forward-port r59310:
os.access now returns True on Windows for any existing directory.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 03 Dec 2007 23:09:04 +0000 |
| parents | 7577b99ec53b |
| children | 26384b8180c7 |
line wrap: on
line diff
--- a/Modules/posixmodule.c Mon Dec 03 22:02:10 2007 +0000 +++ b/Modules/posixmodule.c Mon Dec 03 23:09:04 2007 +0000 @@ -1540,8 +1540,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",
