diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2015-05-03 01:15:18 (GMT) |
---|---|---|
committer | Eric Snow <ericsnowcurrently@gmail.com> | 2015-05-03 01:15:18 (GMT) |
commit | 32439d6eb63f1ea31aed1e45459f0f50f965ef51 (patch) | |
tree | 8603d0565af4892f25b0361e46ffedcc35624f30 /Python/pythonrun.c | |
parent | 6b4c63dea5a1e470849a6925c1b29faea2b01636 (diff) | |
download | cpython-32439d6eb63f1ea31aed1e45459f0f50f965ef51.zip cpython-32439d6eb63f1ea31aed1e45459f0f50f965ef51.tar.gz cpython-32439d6eb63f1ea31aed1e45459f0f50f965ef51.tar.bz2 |
Issue #23911: Move path-based bootstrap code to a separate frozen module.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 952316e..ebedd12 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -304,7 +304,7 @@ set_main_loader(PyObject *d, const char *filename, const char *loader_name) { PyInterpreterState *interp; PyThreadState *tstate; - PyObject *filename_obj, *loader_type, *loader; + PyObject *filename_obj, *bootstrap, *loader_type = NULL, *loader; int result = 0; filename_obj = PyUnicode_DecodeFSDefault(filename); @@ -313,7 +313,12 @@ set_main_loader(PyObject *d, const char *filename, const char *loader_name) /* Get current thread state and interpreter pointer */ tstate = PyThreadState_GET(); interp = tstate->interp; - loader_type = PyObject_GetAttrString(interp->importlib, loader_name); + bootstrap = PyObject_GetAttrString(interp->importlib, + "_bootstrap_external"); + if (bootstrap != NULL) { + loader_type = PyObject_GetAttrString(bootstrap, loader_name); + Py_DECREF(bootstrap); + } if (loader_type == NULL) { Py_DECREF(filename_obj); return -1; |