You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[subinterpreters] Fix PyImport_Import() for subinterpreters #87717
fix PyImport_Import use static silly_list under building Python with --with-experimental-isolated-subinterpreters share silly_list in multi subinterpreters cause crash.
Under the sub interpreters parallel, PyObject_CallFunction clean stack,
Py_DECREF(stack[i]), Py_DECREF silly_list is not thread safe. cause crash
PyObject *
PyImport_Import(PyObject *module_name)
{
PyThreadState *tstate = _PyThreadState_GET();
static PyObject *silly_list = NULL;
...
/* Initialize constant string objects */
if (silly_list == NULL) {
import_str = PyUnicode_InternFromString("__import__");
if (import_str == NULL)
return NULL;
builtins_str = PyUnicode_InternFromString("__builtins__");
if (builtins_str == NULL)
return NULL;
silly_list = PyList_New(0);
if (silly_list == NULL)
return NULL;
}
...
/* Call the __import__ function with the proper argument list
Always use absolute import here.
Calling for side-effect of import. */
r = PyObject_CallFunction(import, "OOOOi", module_name, globals,
globals, silly_list, 0, NULL);
changed the title [-][Subinterpreters]: PyImport_Import use static silly_list under building Python with --with-experimental-isolated-subinterpreters share silly_list in multi subinterpreters cause crash.[/-][+][subinterpreters] Fix PyImport_Import() for subinterpreters[/+]on Mar 22, 2021
changed the title [-][Subinterpreters]: PyImport_Import use static silly_list under building Python with --with-experimental-isolated-subinterpreters share silly_list in multi subinterpreters cause crash.[/-][+][subinterpreters] Fix PyImport_Import() for subinterpreters[/+]on Mar 22, 2021
Activity
JunyiXie commentedon Mar 19, 2021
fix PyImport_Import use static silly_list under building Python with --with-experimental-isolated-subinterpreters share silly_list in multi subinterpreters cause crash.
Under the sub interpreters parallel, PyObject_CallFunction clean stack,
Py_DECREF(stack[i]), Py_DECREF silly_list is not thread safe. cause crash
vstinner commentedon Mar 22, 2021
New changeset 88d9983 by junyixie in branch 'master':
bpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)
88d9983
[-][Subinterpreters]: PyImport_Import use static silly_list under building Python with --with-experimental-isolated-subinterpreters share silly_list in multi subinterpreters cause crash.[/-][+][subinterpreters] Fix PyImport_Import() for subinterpreters[/+][-][Subinterpreters]: PyImport_Import use static silly_list under building Python with --with-experimental-isolated-subinterpreters share silly_list in multi subinterpreters cause crash.[/-][+][subinterpreters] Fix PyImport_Import() for subinterpreters[/+]vstinner commentedon Mar 22, 2021
See bpo-43592: test_importlib: test_multiprocessing_pool_circular_import() fails with "Too many open files" error on os.pipe().