@@ -593,7 +593,7 @@ get_inheritable(int fd, int raise)
593593 handle = (HANDLE )_get_osfhandle (fd );
594594 if (handle == INVALID_HANDLE_VALUE ) {
595595 if (raise )
596- PyErr_SetFromWindowsErr ( 0 );
596+ PyErr_SetFromErrno ( PyExc_OSError );
597597 return -1 ;
598598 }
599599
@@ -648,10 +648,10 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
648648
649649 if (atomic_flag_works != NULL && !inheritable ) {
650650 if (* atomic_flag_works == -1 ) {
651- int inheritable = get_inheritable (fd , raise );
652- if (inheritable == -1 )
651+ int isInheritable = get_inheritable (fd , raise );
652+ if (isInheritable == -1 )
653653 return -1 ;
654- * atomic_flag_works = !inheritable ;
654+ * atomic_flag_works = !isInheritable ;
655655 }
656656
657657 if (* atomic_flag_works )
@@ -668,7 +668,7 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
668668 handle = (HANDLE )_get_osfhandle (fd );
669669 if (handle == INVALID_HANDLE_VALUE ) {
670670 if (raise )
671- PyErr_SetFromWindowsErr ( 0 );
671+ PyErr_SetFromErrno ( PyExc_OSError );
672672 return -1 ;
673673 }
674674
@@ -1027,7 +1027,7 @@ _Py_dup(int fd)
10271027#ifdef MS_WINDOWS
10281028 handle = (HANDLE )_get_osfhandle (fd );
10291029 if (handle == INVALID_HANDLE_VALUE ) {
1030- PyErr_SetFromWindowsErr ( 0 );
1030+ PyErr_SetFromErrno ( PyExc_OSError );
10311031 return -1 ;
10321032 }
10331033
0 commit comments