[Python-checkins] r59310 - in python/branches/release25-maint: Misc/NEWS Modules/posixmodule.c
martin.v.loewis
python-checkins at python.org
Mon Dec 3 23:39:10 CET 2007
Author: martin.v.loewis
Date: Mon Dec 3 23:39:10 2007
New Revision: 59310
Modified:
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Modules/posixmodule.c
Log:
os.access now returns True on Windows for any existing directory.
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Mon Dec 3 23:39:10 2007
@@ -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.
Modified: python/branches/release25-maint/Modules/posixmodule.c
==============================================================================
--- python/branches/release25-maint/Modules/posixmodule.c (original)
+++ python/branches/release25-maint/Modules/posixmodule.c Mon Dec 3 23:39:10 2007
@@ -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",
More information about the Python-checkins
mailing list