Reading through the C API documentation, I find: ``This is done so that dynamically loaded extensions compiled with thread support enabled can be loaded by an interpreter that was compiled with disabled thread support.''
I've currently got the set-up-SSL-threading code in _ssl.c surrounded by a "#ifdef HAVE_THREAD" bracket. It sounds like that might not be sufficient. It sounds like I need a runtime test for thread availability, instead, like this: #ifdef HAVE_THREAD if (PyEval_ThreadsInitialized()) _setup_ssl_threads(); #endif Seem right? So what happens when someone loads the _ssl module, initializes the threads, and tries to use SSL? It's going to start failing again. I think I need my own version of Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS, don't I? Which also checks to see if the SSL threading support has been initialized, in addition to the Python threading support. Something like #define SSL_ALLOW_THREADS {if (_ssl_locks != NULL) { Py_BEGIN_ALLOW_THREADS }} #define SSL_DISALLOW_THREADS {if (_ssl_locks != NULL) { Py_BEGIN_ALLOW_THREADS }} Any comments? Bill _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com