File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change
1
+ The :mod: `ssl ` and :mod: `hashlib ` modules now actively check that OpenSSL is
2
+ build with thread support. Python 3.7.0 made thread support mandatory and no
3
+ longer works safely with a no-thread builds.
Original file line number Diff line number Diff line change 26
26
#include <openssl/objects.h>
27
27
#include "openssl/err.h"
28
28
29
+ #ifndef OPENSSL_THREADS
30
+ # error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
31
+ #endif
32
+
29
33
#if (OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER )
30
34
/* OpenSSL < 1.1.0 */
31
35
#define EVP_MD_CTX_new EVP_MD_CTX_create
Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ static PySocketModule_APIObject PySocketModule;
75
75
# endif
76
76
#endif
77
77
78
+ #ifndef OPENSSL_THREADS
79
+ # error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
80
+ #endif
81
+
78
82
/* SSL error object */
79
83
static PyObject * PySSLErrorObject ;
80
84
static PyObject * PySSLCertVerificationErrorObject ;
@@ -6008,7 +6012,7 @@ PyInit__ssl(void)
6008
6012
if (!_setup_ssl_threads ()) {
6009
6013
return NULL ;
6010
6014
}
6011
- #elif OPENSSL_VERSION_1_1 && defined( OPENSSL_THREADS )
6015
+ #elif OPENSSL_VERSION_1_1
6012
6016
/* OpenSSL 1.1.0 builtin thread support is enabled */
6013
6017
_ssl_locks_count ++ ;
6014
6018
#endif
You can’t perform that action at this time.
0 commit comments