Commit d617c40a authored by Brett Cannon's avatar Brett Cannon

Issue #14605: Insert to the front of sys.path_hooks instead of appending.

parent 4e5b543f
......@@ -215,7 +215,7 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
self.doTestImports(i)
def testPathHook(self):
sys.path_hooks.append(PathImporter)
sys.path_hooks.insert(0, PathImporter)
sys.path.append(test_path)
self.doTestImports()
......@@ -228,7 +228,7 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
def testImpWrapper(self):
i = ImpWrapper()
sys.meta_path.append(i)
sys.path_hooks.append(ImpWrapper)
sys.path_hooks.insert(0, ImpWrapper)
mnames = (
"colorsys", "urllib.parse", "distutils.core", "sys",
)
......
......@@ -145,7 +145,7 @@ class ThreadedImportTests(unittest.TestCase):
def path_hook(path):
finder.find_module('')
raise ImportError
sys.path_hooks.append(path_hook)
sys.path_hooks.insert(0, path_hook)
sys.meta_path.append(flushing_finder)
try:
# Flush the cache a first time
......
......@@ -268,8 +268,8 @@ _PyImportZip_Init(void)
"# can't import zipimport.zipimporter\n");
}
else {
/* sys.path_hooks.append(zipimporter) */
err = PyList_Append(path_hooks, zipimporter);
/* sys.path_hooks.insert(0, zipimporter) */
err = PyList_Insert(path_hooks, 0, zipimporter);
Py_DECREF(zipimporter);
if (err < 0) {
goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment