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
2945e78b
Commit
2945e78b
authored
Apr 25, 2012
by
Marc-Andre Lemburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoader
parent
a5798ded
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
18 deletions
+15
-18
Doc/library/importlib.rst
Doc/library/importlib.rst
+5
-8
Lib/imp.py
Lib/imp.py
+1
-1
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+2
-2
Lib/importlib/abc.py
Lib/importlib/abc.py
+1
-1
Lib/importlib/machinery.py
Lib/importlib/machinery.py
+1
-1
Lib/importlib/test/source/test_case_sensitivity.py
Lib/importlib/test/source/test_case_sensitivity.py
+1
-1
Lib/importlib/test/source/test_file_loader.py
Lib/importlib/test/source/test_file_loader.py
+1
-1
Lib/importlib/test/source/test_finder.py
Lib/importlib/test/source/test_finder.py
+1
-1
Lib/importlib/test/test_abc.py
Lib/importlib/test/test_abc.py
+1
-1
Misc/NEWS
Misc/NEWS
+1
-1
No files found.
Doc/library/importlib.rst
View file @
2945e78b
...
...
@@ -606,18 +606,15 @@ find and load modules.
Load the specified module if it is the same as :attr:`name`.
.. class::
_
SourcelessFileLoader(fullname, path)
.. class:: SourcelessFileLoader(fullname, path)
A concrete implementation of :class:`importlib.abc.FileLoader` which can
import bytecode files (i.e. no source code files exist).
It is **strongly** suggested you do not rely on this loader (hence the
leading underscore of the class). Direct use of bytecode files (and thus not
source code files) inhibits your modules from being usable by all Python
implementations. It also runs the risk of your bytecode files not being
usable by new versions of Python which change the bytecode format. This
class is only documented as it is directly used by import and thus can
potentially have instances show up as a module'
s
``
__loader__
``
attribute
.
Please note that direct use of bytecode files (and thus not source code
files) inhibits your modules from being usable by all Python
implementations or new versions of Python which change the bytecode
format.
.. versionadded:: 3.3
...
...
Lib/imp.py
View file @
2945e78b
...
...
@@ -94,7 +94,7 @@ def load_source(name, pathname, file=None):
class
_LoadCompiledCompatibility
(
_HackedGetData
,
_bootstrap
.
_
SourcelessFileLoader
):
_bootstrap
.
SourcelessFileLoader
):
"""Compatibility support for implementing load_compiled()."""
...
...
Lib/importlib/_bootstrap.py
View file @
2945e78b
...
...
@@ -671,7 +671,7 @@ class SourceFileLoader(FileLoader, SourceLoader):
pass
class
_
SourcelessFileLoader
(
FileLoader
,
_LoaderBasics
):
class
SourcelessFileLoader
(
FileLoader
,
_LoaderBasics
):
"""Loader which handles sourceless file imports."""
...
...
@@ -1198,7 +1198,7 @@ def _setup(sys_module, _imp_module):
supported_loaders
=
[(
ExtensionFileLoader
,
_suffix_list
(
3
),
False
),
(
SourceFileLoader
,
_suffix_list
(
1
),
True
),
(
_
SourcelessFileLoader
,
_suffix_list
(
2
),
True
)]
(
SourcelessFileLoader
,
_suffix_list
(
2
),
True
)]
setattr
(
self_module
,
'_DEFAULT_PATH_HOOK'
,
FileFinder
.
path_hook
(
*
supported_loaders
))
...
...
Lib/importlib/abc.py
View file @
2945e78b
...
...
@@ -119,7 +119,7 @@ class FileLoader(_bootstrap.FileLoader, ResourceLoader, ExecutionLoader):
ExecutionLoader ABCs."""
_register
(
FileLoader
,
machinery
.
SourceFileLoader
,
machinery
.
_
SourcelessFileLoader
)
machinery
.
SourcelessFileLoader
)
class
SourceLoader
(
_bootstrap
.
SourceLoader
,
ResourceLoader
,
ExecutionLoader
):
...
...
Lib/importlib/machinery.py
View file @
2945e78b
...
...
@@ -5,5 +5,5 @@ from ._bootstrap import FrozenImporter
from
._bootstrap
import
PathFinder
from
._bootstrap
import
FileFinder
from
._bootstrap
import
SourceFileLoader
from
._bootstrap
import
_
SourcelessFileLoader
from
._bootstrap
import
SourcelessFileLoader
from
._bootstrap
import
ExtensionFileLoader
Lib/importlib/test/source/test_case_sensitivity.py
View file @
2945e78b
...
...
@@ -24,7 +24,7 @@ class CaseSensitivityTest(unittest.TestCase):
(
_bootstrap
.
SourceFileLoader
,
_bootstrap
.
_suffix_list
(
imp
.
PY_SOURCE
),
True
),
(
_bootstrap
.
_
SourcelessFileLoader
,
(
_bootstrap
.
SourcelessFileLoader
,
_bootstrap
.
_suffix_list
(
imp
.
PY_COMPILED
),
True
))
return
finder
.
find_module
(
self
.
name
)
...
...
Lib/importlib/test/source/test_file_loader.py
View file @
2945e78b
...
...
@@ -379,7 +379,7 @@ class SourceLoaderBadBytecodeTest(BadBytecodeTest):
class
SourcelessLoaderBadBytecodeTest
(
BadBytecodeTest
):
loader
=
_bootstrap
.
_
SourcelessFileLoader
loader
=
_bootstrap
.
SourcelessFileLoader
def
test_empty_file
(
self
):
def
test
(
name
,
mapping
,
bytecode_path
):
...
...
Lib/importlib/test/source/test_finder.py
View file @
2945e78b
...
...
@@ -38,7 +38,7 @@ class FinderTests(abc.FinderTests):
def
import_
(
self
,
root
,
module
):
loader_details
=
[(
_bootstrap
.
SourceFileLoader
,
_bootstrap
.
_suffix_list
(
imp
.
PY_SOURCE
),
True
),
(
_bootstrap
.
_
SourcelessFileLoader
,
(
_bootstrap
.
SourcelessFileLoader
,
_bootstrap
.
_suffix_list
(
imp
.
PY_COMPILED
),
True
)]
finder
=
_bootstrap
.
FileFinder
(
root
,
*
loader_details
)
return
finder
.
find_module
(
module
)
...
...
Lib/importlib/test/test_abc.py
View file @
2945e78b
...
...
@@ -62,7 +62,7 @@ class ExecutionLoader(InheritanceTests, unittest.TestCase):
class
FileLoader
(
InheritanceTests
,
unittest
.
TestCase
):
superclasses
=
[
abc
.
ResourceLoader
,
abc
.
ExecutionLoader
]
subclasses
=
[
machinery
.
SourceFileLoader
,
machinery
.
_
SourcelessFileLoader
]
subclasses
=
[
machinery
.
SourceFileLoader
,
machinery
.
SourcelessFileLoader
]
class
SourceLoader
(
InheritanceTests
,
unittest
.
TestCase
):
...
...
Misc/NEWS
View file @
2945e78b
...
...
@@ -84,7 +84,7 @@ Library
which send EOF without trailing \r\n.
- Issue #14605: Add importlib.abc.FileLoader, importlib.machinery.(FileFinder,
SourceFileLoader,
_
SourcelessFileLoader, ExtensionFileLoader).
SourceFileLoader, SourcelessFileLoader, ExtensionFileLoader).
- Issue #13959: imp.cache_from_source()/source_from_cache() now follow
os.path.join()/split() semantics for path manipulation instead of its prior,
...
...
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