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
0515619d
Commit
0515619d
authored
Feb 21, 2009
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the source/bytecode loader from importlib to use more of the PEP 302
protocol API.
parent
4afab6b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
Lib/importlib/NOTES
Lib/importlib/NOTES
+2
-0
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+1
-3
No files found.
Lib/importlib/NOTES
View file @
0515619d
...
...
@@ -7,6 +7,7 @@ to do
+ PyLoader (for ABC)
- load_module for source only
- get_code for source only
+ PyFileLoader(PyLoader)
...
...
@@ -17,6 +18,7 @@ to do
+PyPycLoader (PyLoader, for ABC)
- load_module for source and bytecode
- get_code for source and bytecode
+ PyPycFileLoader(PyPycLoader, PyFileLoader)
...
...
Lib/importlib/_bootstrap.py
View file @
0515619d
...
...
@@ -361,7 +361,6 @@ class _PyFileLoader:
# Not a property for easy overriding.
return
self
.
_find_path
(
imp
.
PY_COMPILED
)
@
check_name
@
module_for_loader
def
load_module
(
self
,
module
):
"""Load a Python source or bytecode module."""
...
...
@@ -371,7 +370,7 @@ class _PyFileLoader:
code_object
=
self
.
get_code
(
module
.
__name__
)
module
.
__file__
=
source_path
if
source_path
else
bytecode_path
module
.
__loader__
=
self
if
self
.
_is_pkg
:
if
self
.
is_package
(
name
)
:
module
.
__path__
=
[
module
.
__file__
.
rsplit
(
path_sep
,
1
)[
0
]]
module
.
__package__
=
module
.
__name__
if
not
hasattr
(
module
,
'__path__'
):
...
...
@@ -429,7 +428,6 @@ class _PyFileLoader:
else
:
raise
@
check_name
def
get_code
(
self
,
name
):
"""Return the code object for the module."""
# XXX Care enough to make sure this call does not happen if the magic
...
...
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