[Python-checkins] cpython: Fix compilation under MSVC: ssl_set_mode() is a macro, and the MSVC

antoine.pitrou python-checkins at python.org
Sat May 25 13:23:11 CEST 2013


http://hg.python.org/cpython/rev/0bf4a6b56eb5
changeset:   83918:0bf4a6b56eb5
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sat May 25 13:23:03 2013 +0200
summary:
  Fix compilation under MSVC: ssl_set_mode() is a macro, and the MSVC preprocessor doesn't process #ifdef's inside a macro argument list.

(found explanation at http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2007-05/msg00385.html)

files:
  Modules/_ssl.c |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -470,6 +470,7 @@
 {
     PySSLSocket *self;
     SSL_CTX *ctx = sslctx->ctx;
+    long mode;
 
     self = PyObject_New(PySSLSocket, &PySSLSocket_Type);
     if (self == NULL)
@@ -490,11 +491,11 @@
     PySSL_END_ALLOW_THREADS
     SSL_set_app_data(self->ssl,self);
     SSL_set_fd(self->ssl, sock->sock_fd);
-    SSL_set_mode(self->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
+    mode = SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER;
 #ifdef SSL_MODE_AUTO_RETRY
-                 | SSL_MODE_AUTO_RETRY
+    mode |= SSL_MODE_AUTO_RETRY;
 #endif
-                 );
+    SSL_set_mode(self->ssl, mode);
 
 #if HAVE_SNI
     if (server_hostname != NULL)

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


More information about the Python-checkins mailing list