diff options
author | Marc-Andre Lemburg <mal@egenix.com> | 2012-04-25 02:11:07 +0200 |
---|---|---|
committer | Marc-Andre Lemburg <mal@egenix.com> | 2012-04-25 02:11:07 +0200 |
commit | d638c912a438960f97d3990db86388e72a08cb77 (patch) | |
tree | 553fccc0f370f0ad361ac4f85f0c2ca9bc06d346 | |
parent | faa2bc2faf5d48e957c7737e85888abb9c6bd639 (diff) | |
download | cpython-d638c912a438960f97d3990db86388e72a08cb77.tar.gz |
Issue #14605: Revert renaming of _SourcelessFileLoader, since it caused
the buildbots to fail.
-rw-r--r-- | Doc/library/importlib.rst | 13 | ||||
-rw-r--r-- | Lib/imp.py | 2 | ||||
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 | ||||
-rw-r--r-- | Lib/importlib/abc.py | 2 | ||||
-rw-r--r-- | Lib/importlib/machinery.py | 2 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_case_sensitivity.py | 2 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_file_loader.py | 2 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_finder.py | 2 | ||||
-rw-r--r-- | Lib/importlib/test/test_abc.py | 2 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
10 files changed, 18 insertions, 15 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index a8013d278a..de29e4feb3 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -606,15 +606,18 @@ 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). - 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. + 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. .. versionadded:: 3.3 diff --git a/Lib/imp.py b/Lib/imp.py index 0388d0881a..f35247c66c 100644 --- a/Lib/imp.py +++ b/Lib/imp.py @@ -94,7 +94,7 @@ def load_source(name, pathname, file=None): class _LoadCompiledCompatibility(_HackedGetData, - _bootstrap.SourcelessFileLoader): + _bootstrap._SourcelessFileLoader): """Compatibility support for implementing load_compiled().""" diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 817fe39e26..d9df2b77c0 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -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)) diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py index c171da37ae..baa09fd885 100644 --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -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): diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py index 07465ced68..c9906c7acc 100644 --- a/Lib/importlib/machinery.py +++ b/Lib/importlib/machinery.py @@ -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 diff --git a/Lib/importlib/test/source/test_case_sensitivity.py b/Lib/importlib/test/source/test_case_sensitivity.py index f65f285dad..d4bae8de06 100644 --- a/Lib/importlib/test/source/test_case_sensitivity.py +++ b/Lib/importlib/test/source/test_case_sensitivity.py @@ -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) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py index c4c75451c2..764dcff035 100644 --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -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): diff --git a/Lib/importlib/test/source/test_finder.py b/Lib/importlib/test/source/test_finder.py index 32ebd73dc2..f5de58a73e 100644 --- a/Lib/importlib/test/source/test_finder.py +++ b/Lib/importlib/test/source/test_finder.py @@ -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) diff --git a/Lib/importlib/test/test_abc.py b/Lib/importlib/test/test_abc.py index 008bd21ff8..e9eec60fce 100644 --- a/Lib/importlib/test/test_abc.py +++ b/Lib/importlib/test/test_abc.py @@ -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): @@ -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, |