diff options
author | Stefan Krah <skrah@bytereef.org> | 2013-01-17 16:07:17 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2013-01-17 16:07:17 (GMT) |
commit | 20d60803d520a40ea79e1f1bb00dd9fb548d761c (patch) | |
tree | 680ab5b0166bc73800b8383174f7fcb45b25a9e8 /Modules | |
parent | 6a56b8ab9c433b259c6f80ee235ca94eab2d84e8 (diff) | |
download | cpython-20d60803d520a40ea79e1f1bb00dd9fb548d761c.zip cpython-20d60803d520a40ea79e1f1bb00dd9fb548d761c.tar.gz cpython-20d60803d520a40ea79e1f1bb00dd9fb548d761c.tar.bz2 |
Issue #16982: Fix --without-threads build failure.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ssl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 8212cd1..268ae93 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2392,15 +2392,17 @@ _servername_callback(SSL *s, int *al, void *args) 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 @@ _servername_callback(SSL *s, int *al, void *args) 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; } |