mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Issue #14605: Expose importlib.abc.FileLoader and
importlib.machinery.(FileFinder, SourceFileLoader, _SourcelessFileLoader, ExtensionFileLoader). This exposes all of importlib's mechanisms that will become public on the sys module.
This commit is contained in:
parent
8c5e920ae3
commit
938d44d59c
17 changed files with 3246 additions and 3076 deletions
|
@ -71,7 +71,7 @@ class _HackedGetData:
|
|||
|
||||
def get_data(self, path):
|
||||
"""Gross hack to contort loader to deal w/ load_*()'s bad API."""
|
||||
if self.file and path == self._path:
|
||||
if self.file and path == self.path:
|
||||
with self.file:
|
||||
# Technically should be returning bytes, but
|
||||
# SourceLoader.get_code() just passed what is returned to
|
||||
|
@ -83,7 +83,7 @@ class _HackedGetData:
|
|||
return super().get_data(path)
|
||||
|
||||
|
||||
class _LoadSourceCompatibility(_HackedGetData, _bootstrap._SourceFileLoader):
|
||||
class _LoadSourceCompatibility(_HackedGetData, _bootstrap.SourceFileLoader):
|
||||
|
||||
"""Compatibility support for implementing load_source()."""
|
||||
|
||||
|
@ -115,7 +115,7 @@ def load_package(name, path):
|
|||
break
|
||||
else:
|
||||
raise ValueError('{!r} is not a package'.format(path))
|
||||
return _bootstrap._SourceFileLoader(name, path).load_module(name)
|
||||
return _bootstrap.SourceFileLoader(name, path).load_module(name)
|
||||
|
||||
|
||||
# XXX deprecate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue