]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #14605: Revert renaming of _SourcelessFileLoader, since it caused
authorMarc-Andre Lemburg <mal@egenix.com>
Wed, 25 Apr 2012 00:11:07 +0000 (02:11 +0200)
committerMarc-Andre Lemburg <mal@egenix.com>
Wed, 25 Apr 2012 00:11:07 +0000 (02:11 +0200)
the buildbots to fail.

Doc/library/importlib.rst
Lib/imp.py
Lib/importlib/_bootstrap.py
Lib/importlib/abc.py
Lib/importlib/machinery.py
Lib/importlib/test/source/test_case_sensitivity.py
Lib/importlib/test/source/test_file_loader.py
Lib/importlib/test/source/test_finder.py
Lib/importlib/test/test_abc.py
Misc/NEWS

index a8013d278a4d3236040f53a465f197270918270a..de29e4feb3ff08faa42024a3c2e1545dcaae3597 100644 (file)
@@ -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
 
index 0388d0881a53d526f78bbee03e6a1c18b4fe2564..f35247c66cbc26440447929c5604aa5d486d8a53 100644 (file)
@@ -94,7 +94,7 @@ def load_source(name, pathname, file=None):
 
 
 class _LoadCompiledCompatibility(_HackedGetData,
-        _bootstrap.SourcelessFileLoader):
+        _bootstrap._SourcelessFileLoader):
 
     """Compatibility support for implementing load_compiled()."""
 
index 817fe39e266009486c31ff3a4e521326e4d8196d..d9df2b77c074ef5819ae39454d53d9c5ab3bef48 100644 (file)
@@ -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))
 
index c171da37aee307b0d34d52d5e61384079f922f47..baa09fd8850d37417b39051ff77334aa0b32a9b0 100644 (file)
@@ -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):
index 07465ced68a5281c46e380b3a60160aba1f2efd4..c9906c7accf989ccf55e113ce7eefdc586891f39 100644 (file)
@@ -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
index f65f285dad97338b3f7399fea14325d2e7a84cfb..d4bae8de061af08020f9e402f119b6089813e79c 100644 (file)
@@ -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)
index c4c75451c2941c69cfe7e81d033accff064e537d..764dcff0359eeaf209f72b5ed89b6b6860fcb008 100644 (file)
@@ -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):
index 32ebd73dc202ac678b5bf904765704420f1d3ca7..f5de58a73e952d0f57b30f20d45110ca311e7822 100644 (file)
@@ -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)
index 008bd21ff885e00465708bf50172e40617b384fc..e9eec60fcee76a8ef172a5881d5bc65360eeab1a 100644 (file)
@@ -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):
index d6a44e2bc5b333ef03ebd5162679e68464cb615e..b8e28c166dfd52b5279b73f0de330da439feb0e2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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,