summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-07-17 11:16:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-07-17 11:16:04 (GMT)
commitcaaf53e748f664c40d77649fd47df0a8ab01ec27 (patch)
tree6d7499bbc5dfd6a257e9c12c19c4e0e0709cfd1d
parent740527abb61294114868cd039a8f545d0bfe8270 (diff)
parent80ab069f1b040b7418833d9c1facf77ad2bd4363 (diff)
downloadcpython-caaf53e748f664c40d77649fd47df0a8ab01ec27.zip
cpython-caaf53e748f664c40d77649fd47df0a8ab01ec27.tar.gz
cpython-caaf53e748f664c40d77649fd47df0a8ab01ec27.tar.bz2
Issue #27419: Added temporary workaround for subinterpreters.
-rw-r--r--Python/import.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 7a2c92e..ebad07b 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1557,7 +1557,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;