Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d617c40a
Commit
d617c40a
authored
Apr 24, 2012
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14605: Insert to the front of sys.path_hooks instead of appending.
parent
4e5b543f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
Lib/test/test_importhooks.py
Lib/test/test_importhooks.py
+2
-2
Lib/test/test_threaded_import.py
Lib/test/test_threaded_import.py
+1
-1
Python/import.c
Python/import.c
+2
-2
No files found.
Lib/test/test_importhooks.py
View file @
d617c40a
...
...
@@ -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"
,
)
...
...
Lib/test/test_threaded_import.py
View file @
d617c40a
...
...
@@ -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
...
...
Python/import.c
View file @
d617c40a
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment