[Python-checkins] cpython: Issue #16982: Fix --without-threads build failure.

stefan.krah python-checkins at python.org
Thu Jan 17 17:08:21 CET 2013


http://hg.python.org/cpython/rev/8630fa732cf6
changeset:   81559:8630fa732cf6
user:        Stefan Krah <skrah at bytereef.org>
date:        Thu Jan 17 17:07:17 2013 +0100
summary:
  Issue #16982: Fix --without-threads build failure.

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


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2392,15 +2392,17 @@
     PyObject *result;
     /* The high-level ssl.SSLSocket object */
     PyObject *ssl_socket;
-    PyGILState_STATE gstate;
     const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
-
-    gstate = PyGILState_Ensure();
+#ifdef WITH_THREAD
+    PyGILState_STATE gstate = PyGILState_Ensure();
+#endif
 
     if (ssl_ctx->set_hostname == NULL) {
         /* remove race condition in this the call back while if removing the
          * callback is in progress */
+#ifdef WITH_THREAD
         PyGILState_Release(gstate);
+#endif
         return SSL_TLSEXT_ERR_OK;
     }
 
@@ -2449,14 +2451,18 @@
         Py_DECREF(result);
     }
 
+#ifdef WITH_THREAD
     PyGILState_Release(gstate);
+#endif
     return ret;
 
 error:
     Py_DECREF(ssl_socket);
     *al = SSL_AD_INTERNAL_ERROR;
     ret = SSL_TLSEXT_ERR_ALERT_FATAL;
+#ifdef WITH_THREAD
     PyGILState_Release(gstate);
+#endif
     return ret;
 }
 

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


More information about the Python-checkins mailing list