Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2945e78

Browse files
committed
Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoader
1 parent a5798de commit 2945e78

10 files changed

Lines changed: 15 additions & 18 deletions

File tree

Doc/library/importlib.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -606,18 +606,15 @@ find and load modules.
606606
Load the specified module if it is the same as :attr:`name`.
607607

608608

609-
.. class:: _SourcelessFileLoader(fullname, path)
609+
.. class:: SourcelessFileLoader(fullname, path)
610610

611611
A concrete implementation of :class:`importlib.abc.FileLoader` which can
612612
import bytecode files (i.e. no source code files exist).
613613

614-
It is **strongly** suggested you do not rely on this loader (hence the
615-
leading underscore of the class). Direct use of bytecode files (and thus not
616-
source code files) inhibits your modules from being usable by all Python
617-
implementations. It also runs the risk of your bytecode files not being
618-
usable by new versions of Python which change the bytecode format. This
619-
class is only documented as it is directly used by import and thus can
620-
potentially have instances show up as a module's ``__loader__`` attribute.
614+
Please note that direct use of bytecode files (and thus not source code
615+
files) inhibits your modules from being usable by all Python
616+
implementations or new versions of Python which change the bytecode
617+
format.
621618

622619
.. versionadded:: 3.3
623620

Lib/imp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def load_source(name, pathname, file=None):
9494

9595

9696
class _LoadCompiledCompatibility(_HackedGetData,
97-
_bootstrap._SourcelessFileLoader):
97+
_bootstrap.SourcelessFileLoader):
9898

9999
"""Compatibility support for implementing load_compiled()."""
100100

Lib/importlib/_bootstrap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def set_data(self, path, data):
671671
pass
672672

673673

674-
class _SourcelessFileLoader(FileLoader, _LoaderBasics):
674+
class SourcelessFileLoader(FileLoader, _LoaderBasics):
675675

676676
"""Loader which handles sourceless file imports."""
677677

@@ -1198,7 +1198,7 @@ def _setup(sys_module, _imp_module):
11981198

11991199
supported_loaders = [(ExtensionFileLoader, _suffix_list(3), False),
12001200
(SourceFileLoader, _suffix_list(1), True),
1201-
(_SourcelessFileLoader, _suffix_list(2), True)]
1201+
(SourcelessFileLoader, _suffix_list(2), True)]
12021202
setattr(self_module, '_DEFAULT_PATH_HOOK',
12031203
FileFinder.path_hook(*supported_loaders))
12041204

Lib/importlib/abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class FileLoader(_bootstrap.FileLoader, ResourceLoader, ExecutionLoader):
119119
ExecutionLoader ABCs."""
120120

121121
_register(FileLoader, machinery.SourceFileLoader,
122-
machinery._SourcelessFileLoader)
122+
machinery.SourcelessFileLoader)
123123

124124

125125
class SourceLoader(_bootstrap.SourceLoader, ResourceLoader, ExecutionLoader):

Lib/importlib/machinery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
from ._bootstrap import PathFinder
66
from ._bootstrap import FileFinder
77
from ._bootstrap import SourceFileLoader
8-
from ._bootstrap import _SourcelessFileLoader
8+
from ._bootstrap import SourcelessFileLoader
99
from ._bootstrap import ExtensionFileLoader

Lib/importlib/test/source/test_case_sensitivity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def find(self, path):
2424
(_bootstrap.SourceFileLoader,
2525
_bootstrap._suffix_list(imp.PY_SOURCE),
2626
True),
27-
(_bootstrap._SourcelessFileLoader,
27+
(_bootstrap.SourcelessFileLoader,
2828
_bootstrap._suffix_list(imp.PY_COMPILED),
2929
True))
3030
return finder.find_module(self.name)

Lib/importlib/test/source/test_file_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def test_read_only_bytecode(self):
379379

380380
class SourcelessLoaderBadBytecodeTest(BadBytecodeTest):
381381

382-
loader = _bootstrap._SourcelessFileLoader
382+
loader = _bootstrap.SourcelessFileLoader
383383

384384
def test_empty_file(self):
385385
def test(name, mapping, bytecode_path):

Lib/importlib/test/source/test_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class FinderTests(abc.FinderTests):
3838
def import_(self, root, module):
3939
loader_details = [(_bootstrap.SourceFileLoader,
4040
_bootstrap._suffix_list(imp.PY_SOURCE), True),
41-
(_bootstrap._SourcelessFileLoader,
41+
(_bootstrap.SourcelessFileLoader,
4242
_bootstrap._suffix_list(imp.PY_COMPILED), True)]
4343
finder = _bootstrap.FileFinder(root, *loader_details)
4444
return finder.find_module(module)

Lib/importlib/test/test_abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ExecutionLoader(InheritanceTests, unittest.TestCase):
6262
class FileLoader(InheritanceTests, unittest.TestCase):
6363

6464
superclasses = [abc.ResourceLoader, abc.ExecutionLoader]
65-
subclasses = [machinery.SourceFileLoader, machinery._SourcelessFileLoader]
65+
subclasses = [machinery.SourceFileLoader, machinery.SourcelessFileLoader]
6666

6767

6868
class SourceLoader(InheritanceTests, unittest.TestCase):

Misc/NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Library
8484
which send EOF without trailing \r\n.
8585

8686
- Issue #14605: Add importlib.abc.FileLoader, importlib.machinery.(FileFinder,
87-
SourceFileLoader, _SourcelessFileLoader, ExtensionFileLoader).
87+
SourceFileLoader, SourcelessFileLoader, ExtensionFileLoader).
8888

8989
- Issue #13959: imp.cache_from_source()/source_from_cache() now follow
9090
os.path.join()/split() semantics for path manipulation instead of its prior,

0 commit comments

Comments
 (0)