From 470268ae1d0e919df838db5b652ab9a8608fc2b8 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Sat, 2 May 2015 19:15:18 -0600 Subject: Issue #23911: Move path-based bootstrap code to a separate frozen module. --- Python/pythonrun.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Python/pythonrun.c') diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 952316e74c..ebedd123f3 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; -- cgit v1.2.1