]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix compilation under MSVC: ssl_set_mode() is a macro, and the MSVC preprocessor...
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 25 May 2013 11:23:03 +0000 (13:23 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 25 May 2013 11:23:03 +0000 (13:23 +0200)
(found explanation at http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2007-05/msg00385.html)

Modules/_ssl.c

index ca41bbfc691f79b204b8bc02b62224b8136c5da4..c64d209ec87b879cd6fc4e764395bd46138da19c 100644 (file)
@@ -470,6 +470,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
 {
     PySSLSocket *self;
     SSL_CTX *ctx = sslctx->ctx;
+    long mode;
 
     self = PyObject_New(PySSLSocket, &PySSLSocket_Type);
     if (self == NULL)
@@ -490,11 +491,11 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
     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)