[Python-checkins] cpython: Issue4905: use INVALID_FILE_ATTRIBUTES where appropriate. (Patch by Ulrich

tim.golden python-checkins at python.org
Fri Oct 25 12:23:37 CEST 2013


http://hg.python.org/cpython/rev/66398e1307f4
changeset:   86621:66398e1307f4
user:        Tim Golden <mail at timgolden.me.uk>
date:        Fri Oct 25 11:22:37 2013 +0100
summary:
  Issue4905: use INVALID_FILE_ATTRIBUTES where appropriate. (Patch by Ulrich Eckhardt)

files:
  Misc/ACKS             |   1 +
  Modules/posixmodule.c |  10 +++++-----
  2 files changed, 6 insertions(+), 5 deletions(-)


diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -342,6 +342,7 @@
 Walter Dörwald
 Hans Eckardt
 Rodolpho Eckhardt
+Ulrich Eckhardt
 David Edelsohn
 John Edmonds
 Grant Edwards
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -487,7 +487,7 @@
      * but this value would get interpreted as (uid_t)-1  by chown
      * and its siblings.   That's not what the user meant!  So we
      * throw an overflow exception instead.   (We already
-     * handled a real -1 with PyLong_AsLongAndOverflow() above.) 
+     * handled a real -1 with PyLong_AsLongAndOverflow() above.)
      */
     if (uid == (uid_t)-1)
         goto overflow;
@@ -594,7 +594,7 @@
      * but this value would get interpreted as (gid_t)-1  by chown
      * and its siblings.   That's not what the user meant!  So we
      * throw an overflow exception instead.   (We already
-     * handled a real -1 with PyLong_AsLongAndOverflow() above.) 
+     * handled a real -1 with PyLong_AsLongAndOverflow() above.)
      */
     if (gid == (gid_t)-1)
         goto overflow;
@@ -2666,7 +2666,7 @@
      * (Directories cannot be read-only on Windows.)
     */
     return_value = PyBool_FromLong(
-        (attr != 0xFFFFFFFF) &&
+        (attr != INVALID_FILE_ATTRIBUTES) &&
             (!(mode & 2) ||
             !(attr & FILE_ATTRIBUTE_READONLY) ||
             (attr & FILE_ATTRIBUTE_DIRECTORY)));
@@ -2938,7 +2938,7 @@
         attr = GetFileAttributesW(path.wide);
     else
         attr = GetFileAttributesA(path.narrow);
-    if (attr == 0xFFFFFFFF)
+    if (attr == INVALID_FILE_ATTRIBUTES)
         result = 0;
     else {
         if (mode & _S_IWRITE)
@@ -7795,7 +7795,7 @@
 
     if (!PyArg_ParseTuple(args, "i:dup", &fd))
         return NULL;
-    
+
     fd = _Py_dup(fd);
     if (fd == -1)
         return NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list