[Python-checkins] cpython (merge 3.4 -> default): Fixes incorrect use of GetLastError where errno should be used.

steve.dower python-checkins at python.org
Sat Mar 14 19:40:12 CET 2015


https://hg.python.org/cpython/rev/4b0d12f0d8fa
changeset:   94988:4b0d12f0d8fa
parent:      94986:7e86b296deeb
parent:      94987:6409b4048b10
user:        Steve Dower <steve.dower at microsoft.com>
date:        Sat Mar 14 11:39:18 2015 -0700
summary:
  Fixes incorrect use of GetLastError where errno should be used.

files:
  Python/fileutils.c |  12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Python/fileutils.c b/Python/fileutils.c
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -733,7 +733,7 @@
     handle = (HANDLE)_get_osfhandle(fd);
     if (handle == INVALID_HANDLE_VALUE) {
         if (raise)
-            PyErr_SetFromWindowsErr(0);
+            PyErr_SetFromErrno(PyExc_OSError);
         return -1;
     }
 
@@ -788,10 +788,10 @@
 
     if (atomic_flag_works != NULL && !inheritable) {
         if (*atomic_flag_works == -1) {
-            int inheritable = get_inheritable(fd, raise);
-            if (inheritable == -1)
+            int isInheritable = get_inheritable(fd, raise);
+            if (isInheritable == -1)
                 return -1;
-            *atomic_flag_works = !inheritable;
+            *atomic_flag_works = !isInheritable;
         }
 
         if (*atomic_flag_works)
@@ -808,7 +808,7 @@
     handle = (HANDLE)_get_osfhandle(fd);
     if (handle == INVALID_HANDLE_VALUE) {
         if (raise)
-            PyErr_SetFromWindowsErr(0);
+            PyErr_SetFromErrno(PyExc_OSError);
         return -1;
     }
 
@@ -1167,7 +1167,7 @@
 #ifdef MS_WINDOWS
     handle = (HANDLE)_get_osfhandle(fd);
     if (handle == INVALID_HANDLE_VALUE) {
-        PyErr_SetFromWindowsErr(0);
+        PyErr_SetFromErrno(PyExc_OSError);
         return -1;
     }
 

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


More information about the Python-checkins mailing list