mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
GH-103092: isolate _ssl (#104725)
This commit is contained in:
parent
8817886ae5
commit
b9c807a260
3 changed files with 21 additions and 14 deletions
|
|
@ -6150,6 +6150,18 @@ sslmodule_init_strings(PyObject *module)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
sslmodule_init_lock(PyObject *module)
|
||||
{
|
||||
_sslmodulestate *state = get_ssl_state(module);
|
||||
state->keylog_lock = PyThread_allocate_lock();
|
||||
if (state->keylog_lock == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyModuleDef_Slot sslmodule_slots[] = {
|
||||
{Py_mod_exec, sslmodule_init_types},
|
||||
{Py_mod_exec, sslmodule_init_exceptions},
|
||||
|
|
@ -6158,9 +6170,8 @@ static PyModuleDef_Slot sslmodule_slots[] = {
|
|||
{Py_mod_exec, sslmodule_init_constants},
|
||||
{Py_mod_exec, sslmodule_init_versioninfo},
|
||||
{Py_mod_exec, sslmodule_init_strings},
|
||||
// XXX gh-103092: fix isolation.
|
||||
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
|
||||
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
|
||||
{Py_mod_exec, sslmodule_init_lock},
|
||||
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
|
@ -6219,6 +6230,8 @@ static void
|
|||
sslmodule_free(void *m)
|
||||
{
|
||||
sslmodule_clear((PyObject *)m);
|
||||
_sslmodulestate *state = get_ssl_state(m);
|
||||
PyThread_free_lock(state->keylog_lock);
|
||||
}
|
||||
|
||||
static struct PyModuleDef _sslmodule_def = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue