[Python-checkins] closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH-9067)

Benjamin Peterson webhook-mailer at python.org
Wed Sep 5 02:29:47 EDT 2018


https://github.com/python/cpython/commit/874809ea389e6434787e773a6054a08e0b81f734
commit: 874809ea389e6434787e773a6054a08e0b81f734
branch: master
author: Erik Janssens <erik.janssens at conceptive.be>
committer: Benjamin Peterson <benjamin at python.org>
date: 2018-09-04T23:29:42-07:00
summary:

closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH-9067)

files:
A Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst
M Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst b/Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst
new file mode 100644
index 000000000000..2dfa1aec9b86
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst
@@ -0,0 +1 @@
+Guard MSVC-specific code in socketmodule.c with ``#ifdef _MSC_VER``.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 3a439c4bfadc..014f3ba8b5ea 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -559,15 +559,18 @@ select_error(void)
 #  define SET_SOCK_ERROR(err) WSASetLastError(err)
 #  define SOCK_TIMEOUT_ERR WSAEWOULDBLOCK
 #  define SOCK_INPROGRESS_ERR WSAEWOULDBLOCK
-#  define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
 #else
 #  define GET_SOCK_ERROR errno
 #  define SET_SOCK_ERROR(err) do { errno = err; } while (0)
 #  define SOCK_TIMEOUT_ERR EWOULDBLOCK
 #  define SOCK_INPROGRESS_ERR EINPROGRESS
-#  define SUPPRESS_DEPRECATED_CALL
 #endif
 
+#ifdef _MSC_VER
+#  define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
+#else
+#  define SUPPRESS_DEPRECATED_CALL
+#endif
 
 #ifdef MS_WINDOWS
 /* Does WSASocket() support the WSA_FLAG_NO_HANDLE_INHERIT flag? */



More information about the Python-checkins mailing list