summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-07-17 11:15:28 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-07-17 11:15:28 (GMT)
commit80ab069f1b040b7418833d9c1facf77ad2bd4363 (patch)
treed0e9b36135fe8bdeb98c7cb65b19d2b04eec395b /Python/import.c
parent6c2f1fd71075ced14e7ba40e232297ba878aadd1 (diff)
downloadcpython-80ab069f1b040b7418833d9c1facf77ad2bd4363.zip
cpython-80ab069f1b040b7418833d9c1facf77ad2bd4363.tar.gz
cpython-80ab069f1b040b7418833d9c1facf77ad2bd4363.tar.bz2
Issue #27419: Added temporary workaround for subinterpreters.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c5
1 files changed, 4 insertions, 1 deletions
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;