[Python-Dev] bug #1513646

Yi Ding yi.s.ding at gmail.com
Wed Jun 28 23:40:49 CEST 2006


Hi guys,

I filed this bug but sourceforge is down so I can't update it:
http://sourceforge.net/tracker/index.php?func=detail&aid=1513646&group_id=5470&atid=105470

Basically, os.access returns the wrong result for W_OK, and that's
because instead of using & it uses && to see if the file is read only.

diff -urdN accessfix/python/Modules/posixmodule.c
stock/python/Modules/posixmodule.c
--- accessfix/python/Modules/posixmodule.c      2006-06-28
14:15:31.368649100 -0700
+++ stock/python/Modules/posixmodule.c  2006-06-28 14:20:26.138047100 -0700
@@ -1402,7 +1402,7 @@
                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));
+       return PyBool_FromLong(!(mode & 2) || !(attr &
FILE_ATTRIBUTE_READONLY));
 #else
        int res;
        if (!PyArg_ParseTuple(args, "eti:access",

Thanks,
Yi


More information about the Python-Dev mailing list