From 80ab069f1b040b7418833d9c1facf77ad2bd4363 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 17 Jul 2016 14:15:28 +0300 Subject: Issue #27419: Added temporary workaround for subinterpreters. --- Python/import.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/import.c b/Python/import.c index c1dc9a0..5025e75 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1526,7 +1526,10 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals, _PyImport_AcquireLock(); #endif /* From this point forward, goto error_with_unlock! */ - builtins_import = _PyDict_GetItemId(interp->builtins_copy, &PyId___import__); + /* XXX interp->builtins_copy is NULL in subinterpreter! */ + builtins_import = _PyDict_GetItemId(interp->builtins_copy ? + interp->builtins_copy : + interp->builtins, &PyId___import__); if (builtins_import == NULL) { PyErr_SetString(PyExc_ImportError, "__import__ not found"); goto error_with_unlock; -- cgit v0.12