diff --git a/third_party/python/Python/import.c b/third_party/python/Python/import.c index c64612697..70721ee71 100644 --- a/third_party/python/Python/import.c +++ b/third_party/python/Python/import.c @@ -152,8 +152,9 @@ _PyImportZip_Init(void) "# can't import zipimport.zipimporter\n"); } else { - /* sys.path_hooks.insert(0, zipimporter) */ - err = PyList_Insert(path_hooks, 0, zipimporter); + /* sys.path_hooks.append(zipimporter) */ + /* add this hook in case of import from external zip */ + err = PyList_Append(path_hooks, zipimporter); Py_DECREF(zipimporter); if (err < 0) { goto error; diff --git a/third_party/python/Python/pylifecycle.c b/third_party/python/Python/pylifecycle.c index e8553e878..6ddc484dd 100644 --- a/third_party/python/Python/pylifecycle.c +++ b/third_party/python/Python/pylifecycle.c @@ -295,6 +295,8 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib) Py_XDECREF(warnings_module); } + _PyImportZip_Init(); + if (!Py_NoSiteFlag) _Py_InitSite(); /* Module site */ }