[Python-checkins] bpo-32282: Remove unnecessary check for `VersionHelpers.h` in `socketmodule.c` on Windows

Steve Dower webhook-mailer at python.org
Sat Jan 6 21:05:21 EST 2018


https://github.com/python/cpython/commit/af11a15c586e980a157c04ee60b6e33dc7228f3f
commit: af11a15c586e980a157c04ee60b6e33dc7228f3f
branch: master
author: Max Bélanger <aeromax at gmail.com>
committer: Steve Dower <steve.dower at microsoft.com>
date: 2018-01-07T13:05:18+11:00
summary:

bpo-32282: Remove unnecessary check for `VersionHelpers.h` in `socketmodule.c` on Windows

files:
A Misc/NEWS.d/next/Core and Builtins/2017-12-12-14-02-28.bpo-32282.xFVMTn.rst
M Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-12-12-14-02-28.bpo-32282.xFVMTn.rst b/Misc/NEWS.d/next/Core and Builtins/2017-12-12-14-02-28.bpo-32282.xFVMTn.rst
new file mode 100644
index 00000000000..1c833c5439b
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2017-12-12-14-02-28.bpo-32282.xFVMTn.rst	
@@ -0,0 +1,2 @@
+Fix an unnecessary ifdef in the include of VersionHelpers.h in socketmodule
+on Windows.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index d52d9db743a..d75a51af9a6 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -297,10 +297,8 @@ if_indextoname(index) -- return the corresponding interface name\n\
 #  include <fcntl.h>
 # endif
 
-#if defined(_MSC_VER) && _MSC_VER >= 1800
 /* Provides the IsWindows7SP1OrGreater() function */
 #include <VersionHelpers.h>
-#endif
 
 #endif
 
@@ -6552,15 +6550,7 @@ PyInit__socket(void)
 
 #ifdef MS_WINDOWS
     if (support_wsa_no_inherit == -1) {
-#if defined(_MSC_VER) && _MSC_VER >= 1800
         support_wsa_no_inherit = IsWindows7SP1OrGreater();
-#else
-        DWORD version = GetVersion();
-        DWORD major = (DWORD)LOBYTE(LOWORD(version));
-        DWORD minor = (DWORD)HIBYTE(LOWORD(version));
-        /* need Windows 7 SP1, 2008 R2 SP1 or later */
-        support_wsa_no_inherit = major > 6 || (major == 6 && minor >= 1);
-#endif
     }
 #endif
 



More information about the Python-checkins mailing list