summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-05-25 11:23:03 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-05-25 11:23:03 (GMT)
commit19fef69b752d5a1e836ba5b552a8e68592503852 (patch)
tree40fdaa6cd10edeeb69807f4ec807af7b36ab7666 /Modules/_ssl.c
parent765f3cce4891ad1e00f809070c3e8d11e85a8a56 (diff)
downloadcpython-19fef69b752d5a1e836ba5b552a8e68592503852.zip
cpython-19fef69b752d5a1e836ba5b552a8e68592503852.tar.gz
cpython-19fef69b752d5a1e836ba5b552a8e68592503852.tar.bz2
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)
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index ca41bbf..c64d209 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -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)