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
0568d6fd
Commit
0568d6fd
authored
Feb 14, 2012
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bring importlib in line w/ changes made in my personal bootstrap branch in the sandbox.
parent
06b57ef9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+15
-1
No files found.
Lib/importlib/_bootstrap.py
View file @
0568d6fd
...
...
@@ -10,6 +10,7 @@ work. One should use importlib as the public-facing version of this module.
# Injected modules are '_warnings', 'imp', 'sys', 'marshal', '_io',
# and '_os' (a.k.a. 'posix', 'nt' or 'os2').
# Injected attribute is path_sep.
# Most injection is handled by _setup().
#
# When editing this code be aware that code executed at import time CANNOT
# reference any injected objects! This includes not only global code but also
...
...
@@ -999,7 +1000,7 @@ def _setup(sys_module, imp_module):
into the global namespace.
As sys is needed for sys.modules access and imp is needed to load built-in
modules those two modules must be explicitly passed in.
modules
,
those two modules must be explicitly passed in.
"""
global
imp
,
sys
...
...
@@ -1035,3 +1036,16 @@ def _setup(sys_module, imp_module):
raise
ImportError
(
'importlib requires posix or nt'
)
setattr
(
self_module
,
'_os'
,
os_module
)
setattr
(
self_module
,
'path_sep'
,
path_sep
)
def
_install
(
sys_module
,
imp_module
):
"""Install importlib as the implementation of import.
It is assumed that imp and sys have been imported and injected into the
global namespace for the module prior to calling this function.
"""
_setup
(
sys_module
,
imp_module
)
orig_import
=
builtins
.
__import__
builtins
.
__import__
=
__import__
builtins
.
__original_import__
=
orig_import
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